从这里http://blog.prabir.me/post/Undo-in-Git.aspx收集的信息如下:
This undo’s your commit and also resets your working tree to the last commit.
1 git reset --hard HEAD^
在我执行了'git push'之后,如何撤销我的最后一次提交?
谢谢。
当我执行'git log'时,我的最新提交是:
commit 29fc764693a5933a379169e22891e4b0d3d2426f
Merge: 002db49 cfb1d8f
如何撤销一个 Git 的修改?
我得到了这个:
$ git revert HEAD
fatal: Commit 29fc764693a5933a379169e22891e4b0d3d2426f is a merge but no -m option was given.
git revert
返回到之前的提交。如果您想要还原合并提交,那就不那么容易了,因为它至少有两个父提交,没有人能够确定哪一个是分支,哪一个是/是合并父提交。您必须使用-m <parent commit>
选项选择要提交到哪个父提交。请查看git help revert
。 - KingCrunch