How to merge large number of changes info common repo?

52 Views Asked by At

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

There are 1 best solutions below

0
André On BEST ANSWER

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.