Http://blog.csdn.net/koffuxu/article/details/6731876git revert is to cancel an operation, the operation before the commit will be retained git reset is to cancel a commit, however, all subsequent modifications will be returned to the temporary storage area. For example, there are three commit, git ST: commit3: Add test3.ccommit2: Add test2.ccommit1: Add test1.c. Execute git revert head ~ 1. commit2 is removed from the GIT log. We can see that: commit1: Add test1.ccommit3: Add test3.cgit status has not changed. If you change to execute git reset -- soft (default) Head ~ 1. Run git logcommit2: Add test2.ccommit1: Add test1.c and run git status. Then test3.c is in the temporary storage zone and is ready to be submitted. Execute git reset -- hard head ~ After 1, it will show: head is now at commit2, run git logcommit2: Add test2.ccommit1: Add test1.c to run git St, no changes. In addition: git revert <commit log string> is used to undo the commit and use it as a new commit.
Differences between git revert and git Reset