如何合并大量的变更信息到共享仓库?

huangapple go评论53阅读模式
英文:

How to merge large number of changes info common repo?

问题

有两名开发者分别在dev1dev2分支上工作,通常每当他们提交更改时,其中一人会将更改提交到公共的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

这是我建议的步骤:

  1. 从共同的dev分支合并到dev2分支。
  2. 在本地解决冲突。
  3. dev2分支向共同的dev分支发起拉取请求(因为之前的合并已经解决了冲突,所以不会有冲突)。

提示:当从共同的dev分支合并到你的分支时,最好接受所有远程更改,然后仔细选择并应用你自己的更改。

英文:

This is the procedure I would recommend:

  1. Dev2 merge from common dev to dev2 branch.
  2. Solve conflicts locally.
  3. Do a pull request from dev2 branch to common dev 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.

huangapple
  • 本文由 发表于 2023年6月16日 05:34:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/76485664.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定