我有一些本地提交,并且对主人进行了更改.所以我做了一个:
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
Run Code Online (Sandbox Code Playgroud)
如何在拉动之前返回并重做合并并推送?特别是在合并之前回到右边.
您可以将该合并恢复为:
git revert -m 1 (Commit id of the merge commit)
Run Code Online (Sandbox Code Playgroud)
更多信息可以在官方指南中找到
并且您可以通过git reflog <branch>在合并之前找出分支的位置以及git reset --hard <commit_id>恢复旧版本(您将返回此提交)以其他方式执行此操作.然后你就push可以回来了.
Reflog将显示分支的旧状态,因此您可以将其返回到您喜欢的任何更改集.
确保你在正确的分支