我错误地将主分支 pull 入开发分支并进行了一些更改。
我想恢复 pull 和提交。
我尝试过这个命令
git revert <commit hash>
但它给了我以下错误
commit <commit hash> is a merge but no -m option was given.
如何恢复 pull 和提交?
最佳答案
git revert尽管“恢复”一词有口语意义,但不是您在这里需要的。
相反,您宁愿将分支重置到错误 pull 之前的位置:
git checkout develop
git reset --hard @{upstream}
其中@{upstream}
是一种构造,意思是“在上游,就像在远程分支中配置的那样从中 pull ”。
此后您不必--force
任何事情,因为您没有改变历史,而是坚持历史。
关于git - 如何撤消最后一次 pull 并提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61727424/