配置
$ git config --global user.name "[name]"
$ git config --global user.email "[email address]"
$ git config --global color.ui auto
创建仓库
$ git init [project-name]
$ git clone [url]
更改
$ git status
$ git diff
$ git add [file]
$ git diff --staged
$ git reset [file]
$ git commit -m "[descriptive message]"
分支
$ git branch
$ git branch [branch-name]
$ git checkout [branch-name]
$ git merge [branch]
$ git branch -d [branch-name]
重构文件名
$ git rm [file]
$ git rm --cached [file]
$ git mv [file-original] [file-renamed]
浏览历史
$ git log
$ git log --follow [file]
$ git diff [first-branch]...[second-branch]
$ git show [commit]
抑制跟踪
*.log build/ temp-*
$ git ls-files --other --ignored --exclude-standard
保存片段
$ git stash
$ git stash pop
$ git stash list
$ git stash drop
重新提交
$ git reset [commit]
$ git reset --hard [commit]
同步更改
$ git fetch [bookmark]
$ git merge [bookmark]/[branch]
$ git push [alias] [branch]
$ git pull
参考文件