我不小心将请求从我的功能分支 merge
到master
分支,这是我不应该的。我正在使用 gogs
。我无法使用恢复按钮,因为没有任何可用功能。我怎样才能将主分支恢复到 pull 请求之前的位置,以便主分支再次干净。
主分支也受到保护,提交只能通过 pull 请求推送。所以 git push -f 不适合我。
我读过其他问题,但它们是关于特定事件的。我不知道如何才能实现这一目标。
最佳答案
如果您在错误 merge 后没有添加任何其他提交,我建议您依赖命令行,如下所示:
git checkout master
git pull
git log --oneline --graph --decorate # Write down the hash of the last good commit
git reset --hard {{last-good-commit-hash}}
# Review your commits, and if it all right...
git push --force # Rewrite branch history, be carefully!!!
关于git - 从 master 分支恢复 merge 的 pull 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67987019/