Git-cheat-sheet
阿新 • • 發佈:2018-12-06
Configure tooling
git config --global user.name 'name'
git config --global user.email 'email'
git config --global color.ui auto
Create repositories
git init repositories-name
git clone url
Make changes
git status git diff git add file git diff --staged git reset file git commit -m "message"
Group changes
git branch
git branch branch-name
git checkout branch-name
git merge branch
git branch -d branch-name
Refactor filenames
git rm file
git rm --cached file
git mv file-original file-renamed
Review history
git log git log --follow file git diff first-branch second-branch git show commit
Redo commits
git reset commits
git reset --hard commits
Save fragments
git stash
git stash pop
git stash list
git stash drop
Synchronize changes
Register a repository bookmark and exchange version history
git fetch bookmark
git merge bookmark/brach
git push alias branch
git pull
Reference
github-git-cheat-sheet