简体   繁体   English

从功能分支中的功能分支中删除合并提交的影响,这两个功能分支都将合并到

[英]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将包含来自b1b2的已解决更改。

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

相关问题 功能分支合并推送后,从主分支中删除功能分支的提交消息 - Remove commit messages of feature branch from master branch after feature branch is merged and pushed 使用Git将非合并功能分支合并到另一个功能分支中 - Merge non-merged feature branch into another feature branch with Git 从提交合并到功能分支 - Merging from commit to feature branch GIT merge develop into feature branch -- 同一个分支被合并和恢复后 - GIT merge develop into feature branch -- after the same branch was merged and reverted 将分支变基或合并到合并到 master 中的另一个功能分支上 - Rebase or merge a branch onto another feature branch merged in master 合并分支但没有合并提交 - Merged a branch but there is no merge commit 从功能分支的某些提交开始进行Git合并 - Git merge starting from certain commit of the feature branch 合并后获取功能分支的提交消息 - Get commit messages of feature branch after merge 如何安排从master分支到我的功能分支的合并,并在我的功能分支上提交自己的工作? - How shall I arrange merge from the master branch into my feature branch and commit of my own work on my feature branch? 将 Hotfix 分支合并到两者后,功能分支是 Master 后面的 1 个提交 - Feature branch is 1 commit behind Master after merging Hotfix branch to both
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM