Created
October 9, 2016 06:27
-
-
Save 52cik/6c0fa91ee31d9b88966aeac1c3c4aa3c to your computer and use it in GitHub Desktop.
git 强行回退
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
假设你有3个commit如下: | |
commit 3 | |
commit 2 | |
commit 1 | |
其中最后一次提交commit 3是错误的,那么可以执行: | |
git reset --hard HEAD~1 | |
你会发现,HEAD is now at commit 2。 | |
然后再使用git push --force将本次变更强行推送至服务器。这样在服务器上的最后一次错误提交也彻底消失了。 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment