[英]Affects of removing a merge commit from a feature branch in a feature branch that will both be merged in
In short, I have merged in changes from a feature branch onto my current feature branch, and have pushed the merge remotely, creating a merge commit with the changes I merged in. Now, the problem is, I didn't need these changes. 简而言之,我已经将更改从功能分支合并到当前功能分支,并远程推送了合并,并使用合并的更改创建了一个合并提交。现在的问题是,我不需要这些更改。 Also, these changes have broken my builds, because I will need to merge in changes from other projects on my current feature branch. 同样,这些更改也破坏了我的构建,因为我将需要合并当前功能分支上其他项目的更改。 I want to avoid doing this, so I want to revert the merge commit. 我想避免这样做,所以我想还原合并提交。
Two feature branches, b1 and b2.
Merged b1 into b2, creating merge commit mc1, on b2.
Want to revert mc1 on b2.
Afraid revert mc1, will affect the merge of b1 into master staging.
I am afraid because I feel like the revert, will obviously have the changes that remove the stuff I merged in from b1, which could remove those changes from master once both branches have been merged into master... 恐怕是因为我想恢复原状,很明显会有更改,这些更改会删除我从b1中合并的内容,一旦两个分支都合并到master中,这些更改可能会将这些更改从master中删除...
Because you haven't removed your previous branch b1
, you should be able to safely revert commits on b2
without losing any changes that were present on b1
. 因为尚未删除先前的分支b1
,所以您应该能够安全地还原b2
提交,而不会丢失b1
上存在的任何更改。
You can revert commits with: 您可以使用以下方法还原提交:
git revert <commit hash>
git checkout <current branch>
Read more about reverting commits here . 在此处阅读有关还原提交的更多信息。
As for conflicts with master
, master
will only have changes that are merged in. If you merge only b1
into master
, master
will have the changes from b1
. 至于与master
冲突, master
将仅具有已合并的更改。如果仅将 b1
合并到master
,则master
将具有b1
的更改。 If you merge only b2
into master
, master
will have the changes from b2
. 如果仅将 b2
合并到master
,则master
将具有b2
的更改。 If you merge b1
and b2
into master
, you may have to resolve any merge conflicts that arise, but master
will then contain the resolved changes from b1
and b2
. 如果将b1
和 b2
合并到master
,则可能必须解决出现的任何合并冲突,但是master
将包含来自b1
和b2
的已解决更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.