英文:
How to merge large number of changes info common repo?
问题
有两名开发者分别在dev1
和dev2
分支上工作,通常每当他们提交更改时,其中一人会将更改提交到公共的dev
分支。两名开发者都进行了大量重大更改,其中一些可能会影响相同的文件。
开发者1已经进行了PR并将其更改合并到了dev
分支。现在开发者2也想将他们的更改合并到dev
分支,但担心可能会发生冲突。
与其直接从dev2
合并到dev
,开发者2最好的方法是查看此合并的结果是什么?例如,他们应该在本地检出dev2
,然后从dev
进行git fetch
,然后解决任何合并冲突吗?还是应该从dev2
合并到dev
?
英文:
There are two developers working on branches dev1
and dev2
, respectively, and usually every time one of them commits a change they do a PR into a common dev
branch.
Both developers have made a bunch of big changes, some of which may affect the same files.
Developer 1 has done a PR and merged their changes into dev
. Now Developer 2 wants to merge their changes into dev
as well but is worried there will be conflicts.
Rather than just doing a PR from dev2
into dev
, what's the best way for Developer 2 to see what the result of this merge will be?
For example, should they checkout dev2
locally and do a git fetch
from dev
, and then fix any merge conflicts? Or do a git merge
from dev2
into dev
?
答案1
得分: 2
这是我建议的步骤:
- 从共同的
dev
分支合并到dev2
分支。 - 在本地解决冲突。
- 从
dev2
分支向共同的dev
分支发起拉取请求(因为之前的合并已经解决了冲突,所以不会有冲突)。
提示:当从共同的dev
分支合并到你的分支时,最好接受所有远程更改,然后仔细选择并应用你自己的更改。
英文:
This is the procedure I would recommend:
- Dev2 merge from common
dev
todev2
branch. - Solve conflicts locally.
- Do a pull request from
dev2
branch to commondev
branch. (There won't be any conflicts because they have been resolved in the previous merge.)
Tip: when merging from common dev
branch into yours it is easier to accept all remote changes and only then carefully pick and apply your own changes.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论