git add .
git commit -m 'message'
git stash
git stash save <message>
git stash pop
git stash apply <id>
git stash drop <id>
git init
git clone https://github.com/ConciseA/learngit.git
git clone -b <branch_name> https://github.com/ConciseA/learngit.git
git remote -v
git remote show/add/remove/rename <远程仓库>
git checkout -- <filename>
git reset --hard HEAD
未被加入暂存区的文件还是会存在
git branch -a/r/v
git checkout -b <branch_name>
git branch <new_branch_name> <tag_name>
git fetch origin
git checkout -b <local_branchname> <remote_branchname>
git pull -p
git push origin :<branch_name>
git push origin --delete <branch_name>
git reset --hard <branch_name>
eg:
git reset --hard HEAD^1
恢复到上次提交
git reset --hard
重置本地修改
git reset --hard 98d3dde
git diff <branch_name> <other_branch_name>
eg:
git fetch origin
git diff master origin/master
git diff master dev
git diff --cached
git diff --check
git tag -n
git tag <tagname>
git tag -a <tagname> -m <message>
git push origin <tagname>
git push origin --tags
git tag -d <tagname>
git push origin :<tagname>
git log -p -2
显示最近两次提交的差异
git log --stat
显示每次提交的简略统计信息
git log --pretty=oneline
不同的风格展示提交历史
git log --pretty=format:"%h %an %ar - %s"
格式化输出
git log --pretty=format:"%h %an %ar - %s" --graph
图标格式化输出
git log --pretty=format:"%h %an %ar - %s" --graph -5
图标格式化输出最近5次提交
git log --name-status
显示新增、修改、删除的文件清单
git log --name-only
文件修改列表
git whatchanged
文件修改列表
git config --global alias.br branch
git config --global alias.st status
git config --global alias.ci commit
git config --global core.whitespace cr-at-eol
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"