$ git fetch upstream
$ git fetch origin
$ git checkout feature-branch
$ git rebase origin/feature-branch
$ git rebase upstream/main
Oh noes! A merge conflict appears here!
Open the file with the conflict, find the conflict markers (>>>>>>
and <<<<<<
) and figure out what the correct change is.
Sometimes it's really easy.
Sometimes it's not.
Once you've resolved the merge conflict and saved changes (and maybe run tests and a linter to make sure you haven't introduced errors)...
$ git rebase --continue
Now you can run tests and a linter (if you didn't before--or even if you did). Then push (with --force
or --force-with-lease
probably).
Merge conflict gone. Hooray. 🎉