简体   繁体   English

GIT:在不合并的情况下更新具有主控更改的功能分支

[英]GIT: Updating a feature branch with changes in master without merge

I'm working on a relatively large GIT repository, which I think follows a reasonably standard setup as follows: Features are developed in new branches, and then get merged back into master . 我正在研究一个相对较大的GIT存储库,我认为它遵循如下合理的标准设置:在新分支中开发功能,然后将其合并回master中

~6 months ago, a feature was partially implemented on a new branch. 大约6个月前,在新分支上部分实现了一项功能。 It turned out that this feature depended on a bunch of other stuff, and so it was put on the back burner until the other stuff was completed. 事实证明,此功能依赖于其他功能,因此将其放回燃烧器,直到完成其他功能为止。 This leaves the branch in question 18 commits ahead of master, and 93 commits behind, and has a mix of contributors, so we don't want to squash it or loose the history. 这样一来,有问题的分支就在master之前提交了18个,在master后面提交了93个,并且有不同的贡献者,所以我们不想压榨它或松开历史记录。

How do I get the current changes from master onto the feature branch please? 如何将当前的更改从master转移到Feature分支?

Only thing I can think of at the moment is merging into master and then immediately re-branching, but there must be a better method of doing this, as the feature is incomplete.... 我目前唯一能想到的就是将其合并到母版中 ,然后立即重新分支,但是由于功能不完整,因此必须有一种更好的方法。

You have two options: 您有两种选择:

  1. Merge master into feature : master合并为feature

     $ git checkout feature $ git merge master 

    This has the disadvantage that you have to resolve all conflicts at one time. 这样做的缺点是您必须一次解决所有冲突。

  2. Rebase feature onto master : feature master

     $ git checkout feature $ git rebase master 

    If there are any conflicts, then you can resolve them manually for each commit in feature 's history. 如果存在任何冲突,则可以针对feature历史记录中的每次提交手动解决它们。 Once the conflicts are resolved and added to the index, you do 解决冲突并将其添加到索引后,您可以

     $ git rebase --continue 

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

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