Git我都做了些什么diff
这个文档, 我们要解决每次add, commit, push的时候, 我们究竟提交了啥的问题.
目标
- 每次commit提交之前, 查看git的修改有哪些.
- 每次add之前, 查看git的修改有哪些.
- 每次push之前, 查看git的修改有哪些.
竟然都是diff
-
目前暂存中的修改:git diff –staged
-
尚未缓存的改动:git diff 缩写: gd
-
查看已缓存的改动: git diff —cached 缩写: gdca
-
查看已缓存的与未缓存的所有改动:git diff HEAD
-
显示摘要而非整个 gds:git diff –stat
-
gdt git diff-tree –no-commit-id –name-only -r
-
gdw git diff –word-diff
-
最后两次提交的差异git diff HEAD^ HEAD
-
git diff HEAD^..HEAD git diff HEAD^.. git diff HEAD^ HEAD git diff HEAD~15 # diff the working tree with the 15th previous commit git diff HEAD~15 HEAD # diff the last commit with the 15th previous commit git diff HEAD~N git diff HEAD~N.. gd HEAD~2 # 这个最简洁. git diff @~..@ git show gsps #git show --pretty=short --show-signature git diff @^ git diff HEAD^ git diff commit_id #这里面 ~=^, @=HEAD gd @^ gd @~ #这两个都是可以的.
- [http://m.runoob.com/git/git-basic-operations.html]
- https://github.com/ohmyzsh/ohmyzsh/wiki/Cheatsheet