撤销已经推送并重做合并的git合并
我有一些本地提交,并且对master进行了更改。 所以我做了一个:
git pull // it automatically merged and had a conflict with one file only.
subl <file> // Made the wrong fix and saved it
git commit // It opened nano and I Typed "fixed merge" saved it
git push master origin
我如何回到拉和重做合并和推? 特别是在合并之前回到正确的位置。
您可以通过以下方式恢复合并:
git revert -m 1 (Commit id of the merge commit)
更多信息可以在官方指南中找到
你可以通过使用git reflog <branch>
来找到你的分支在merge之前的位置,然后用git reset --hard <commit_id>
来恢复旧版本(你会回到这个提交)。 然后,只要你可以push
回来。
Reflog会显示分支的较旧状态,因此您可以将其返回到您喜欢的任何更改。
确保你在正确的分支
您可以恢复到上次提交:
git revert HEAD
它会将您的提交恢复为新的提交
链接地址: http://www.djcxy.com/p/49831.html上一篇: Undo a git merge that has been pushed and redo the merge