Git 使用技巧
最佳实践,每次提交前都使用git status查看已经更改的文件,然后使用git add逐条添加文件,然后再看git status提交的文件是不是都对的. 认真编写.gitignore文件,最好能够做到每次可以使用git add .
是安全的。
取消与重置
当你的 commit 已经 push 之后就不能再撤销了,只能使用 revert。
取消上一个 commit
git reset HEAD~1
- reset --mixed will reset the index not the working dir
- reset --soft will only move the HEAD
- reset --hard will even reset the …