简体   繁体   English

GIT merge develop into feature branch -- 同一个分支被合并和恢复后

[英]GIT merge develop into feature branch -- after the same branch was merged and reverted

I am in a pretty sticky situation with a merge, I hope someone can help me.我在合并方面处于非常棘手的境地,我希望有人能帮助我。

A feature branch was merged into develop some time ago, all good.前段时间合并了一个feature分支到develop,还不错。 Because that feature was not required for a release, the merge was reverted.由于发布不需要该功能,因此恢复了合并。 In the meantime some more feature branches were merged into develop.与此同时,更多的功能分支被合并到开发中。

Now, it is time to re-merge the same feature branch into develop.现在,是时候将相同的功能分支重新合并到开发中了。 As expected, when I try to do that, git will notice that my changes were deleted, so it automatically deletes those files/changes that were part of the original merge in my local feature branch.正如预期的那样,当我尝试这样做时,git 会注意到我的更改已被删除,因此它会自动删除那些属于我本地功能分支中原始合并的文件/更改。

Is there a way to fix this: merge/rebase develop into my feature branch, but keeping all my changes?有没有办法解决这个问题:合并/变基开发到我的功能分支,但保留我所有的更改?

Ok, it was easier than I thought:好的,这比我想象的要容易:

  • updated local develop with git pull使用 git pull 更新本地开发
  • found the ref of the revert commit with git log, copied使用 git 日志找到还原提交的引用,已复制
  • reverted that with git revert <ref_here>, my local develop is pre-revert now通过 git revert <ref_here> 还原,我的本地开发现在预还原
  • git checkout to my feature branch, and finally git merge develop. git 结帐到我的功能分支,最后 git 合并开发。

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

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