git 回滚功能原文地址:http://www.oschina.net/news/26241/you-can-not-change-git-history
$ git init
$ touch foo.txt
$ git add foo.txt
$ git commit -m "initial commit"
$ echo 'new data' >> foo.txt
$ git commit -a -m "more stuff added to foo"
你现在看git的历史记录,你可以看到两次提交:
$ git log
* 98abc5a (HEAD, master) more stuff added to foo
* b7057a9 initial commit
现在让我们来重置回第一次提交的状态:
$ git reset --hard b7057a9
$ git log
* b7057a9 (HEAD, master) initial commit