2

When making PRs, sometimes I get merge conflicts when something is updated in the upstream repo.

At first, I just git pull -r upstream master as usual, but then I have to deal with the merge conflict.

I have no idea how I should start to understand the output of git am --show-current-patch, however, I use Atom editor to resolve the conflicts before continuing the rebase.

The problem I face is that I can either use upstream changes which wipes away all of my work or at least in the section the conflict exists in the file. Or I use mine which does not apply any of the upstream changes.

So, what I do is re-clone the upstream repo, add all of my changes again and make the necessary commits, then I add my remote downstream repo/fork and force push my changes so the PR is updated.

This is long and tedious sometimes and I understand that this could be the only way, but I have to ask. Is there an easier more efficient way? Is the way I do it the only way to do it? Is this what most of the community does?

user27068
  • 43
  • 8
  • Possible duplicate of [How to resolve merge conflicts in Git](https://stackoverflow.com/questions/161813/how-to-resolve-merge-conflicts-in-git) – mkasberg Nov 28 '18 at 17:49

1 Answers1

2

At first, I just git pull -r upstream master as usual, but then I have to deal with the merge conflict

That should be the correct process.
Regarding conflict, try and activate git rerere in order to record your merge conflict resolutions: you won't have to repeat said resolution more than once.
See Git Tools - Rerere.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250