-
Notifications
You must be signed in to change notification settings - Fork 1
HowToGit
Changho Hwang edited this page Oct 25, 2021
·
6 revisions
git config --global user.name "Changho Hwang"
git config --global user.email "ch.hwang128@gmail.com"
cd project_folder
git init
git remote add origin https://gitlab.com/chhwang/project.git
git add first_file_to_commit
git commit
git push -u origin master
git remote set-url origin https://gitlab.com/chhwang/new_project.git
git reset --hard 0d1d7fc32
git commit --amend
git push -f
git push origin branch:new_branch
git push origin --delete branch
git revert HEAD
git fetch
git reset --hard
git pull origin branch_name
git checkout 0d1d7fc32
git fetch
git checkout 0d1d7fc32 -- file_to_checkout
git checkout better_branch
git merge -s ours another_branch
git checkout another_branch
git merge better_branch
git push origin --delete branch_name
git log --pretty=format:"%h %s" --graph
git log --grep="blahblah"
git log --stat
git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | awk '/^blob/ {print substr($0,6)}' | sort --numeric-sort --key=2 | cut --complement --characters=8-40 | numfmt --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest
git log --pretty=oneline --all -- file_path
git filter-branch --tag-name-filter cat --index-filter 'git rm -r --cached --ignore-unmatch filename' --prune-empty -f -- --all
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now
git gc --aggressive --prune=now
git push origin --force --all
git push origin --force --tags