简体   繁体   English

合并另一个分支中的主节点

[英]Merge master in another branch

Supposedly two people are working on a project and one of them, unknowingly from the other, creates a new branch in the project. 假设有两个人在一个项目上工作,其中一个人在不知不觉中从另一个人开始,在项目中创建了一个新分支。 Now, say the first person keeps on pushing changes to the master branch and the other branch gets outdated. 现在,假设第一个人继续将更改推送到master分支,而另一个分支已过时。 How can I push the changes of master branch in to this outdated branch. 如何将master分支的更改推送到该过时的分支中。 For the sake of discussion, let's name that outdated branch as 'outdated-branch'. 为了便于讨论,我们将过时的分支命名为“ outdated-branch”。 Appreciate your help. 感谢您的帮助。

Have yout tried to merge master into outdated-branch ? 您是否尝试过将master合并到outdated-branch

git checkout outdated-branch
git merge master

Two possible ways: merge and rebase 两种可能的方式:合并和变基

First: 第一:

git checkout outdated-branch

Then merge: 然后合并:

git merge master

or rebase: 或变基:

git rebase master

A discussion on advantages and disadvantages of either can be found here . 关于两者的优缺点的讨论可以在这里找到。 The history of outdated-branch will look different other than that they produce the same result (including the same conflicts). 分支的过时历史看起来会有所不同,除了它们产生相同的结果(包括相同的冲突)。

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

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