简体   繁体   English

取消合并git分支,保持合并后提交

[英]Unmerge a git branch, keeping post-merge commits

Say there are two branches master and branchA . 假设有两个分支masterbranchA

I work on master , a friend on branchA . 我在master上工作,在branchAbranchA Once things are finalized, we merge branchA with master . 一旦完成,我们将branchAmaster合并。

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: 其他链接:

  1. Git SCM - Undoing Merges Git SCM - 撤消合并

  2. Git Ready - Rolling back changes with revert Git Ready - 通过还原来回滚更改

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM