推送后撤消git merge [英] Undo a git merge when it has been pushed
问题描述
在合并后已经推送到母版的情况下,如何撤消合并? 这是我的步骤:
How can I undo a merge when I have already pushed to master after merge? Here are my steps:
-
git add -A
git commit -m "some message"
git fetch origin master:master
git rebase master (resolve merge conflicts)
git push -f origin my local branch
我想回到步骤2的状态
推荐答案
您强行按下,这意味着您改写了遥控器上的更改. 您的计算机无法修复;但是,如果在强制推送之前还有另一台具有本地副本的计算机,则可以从该计算机强制推送并覆盖您的强制推送.
You force pushed, meaning you overwrote the changes on a remote. Your computer can't fix it; however, if there is another computer with a local copy before you force pushed, you can force push from that computer and overwrite your force push.
Git的push --force具有破坏性,因为它是无条件的 用您本地的任何内容覆盖远程存储库, 可能会覆盖团队成员推动的任何更改 与此同时. - Atlaissan Git资源
Git's push --force is destructive because it unconditionally overwrites the remote repository with whatever you have locally, possibly overwriting any changes that a team member has pushed in the meantime. - Atlaissan Git Resource
在某些情况下,签出到旧的提交然后强制执行可能会起作用,但是我怀疑这可能对您不起作用,因为您必须强制执行所做的更改.
There are some cases where checking out to an old commit and then force pushing that might work, but I suspect that probably won't work in your case because you had to force push your changes.
这篇关于推送后撤消git merge的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!