[英]Unmerge a git branch, keeping post-merge commits
Say there are two branches master
and branchA
. 假设有两个分支
master
和branchA
。
I work on master
, a friend on branchA
. 我在
master
上工作,在branchA
上branchA
。 Once things are finalized, we merge branchA
with master
. 一旦完成,我们将
branchA
与master
合并。
After several commits on the merged master
, the client wants the work done on branchA
removed, but NOT the commits done after the merge . 在对合并后的
master
进行多次提交后,客户端希望删除branchA
完成的工作,但不要在合并后完成提交 。
How can we do it? 我们怎么做?
Read through Pro Git - Undoing Merges . 阅读Pro Git - 撤消合并 。
Basically, you git revert
the merge commit: 基本上,你
git revert
合并提交:
git revert -m 1 hash_of_merge_commit
You may end up with some conflicts that you'll have to manually unmerge, just like when merging normally. 您最终可能会遇到一些必须手动取消合并的冲突,就像正常合并时一样。
Additional links: 其他链接:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.