Skip to content

Resolving Pull Request merge conflicts

Patrick Bolger edited this page Nov 1, 2015 · 2 revisions

When you submit a Pull Request (PR) there may be conflicts between your submitted code and what is already present in the project repo development branch. (Note that this will rarely happen if you rebase your feature branch against development - see steps 5 and 6 here).

Github indicates PR conflicts with this message: This branch has conflicts that must be resolved.

This process can be followed to address the conflicts. All of the git commands are executed in your local repo.

Step 1: Pull the current project (development) code to your feature branch

git checkout <feature-branch-name>
git pull upstream development

The "pull" command will execute a fetch and a merge.
The merge will fail due to the conflicts.
The output of the command will indicate which files have conflicts.

Step 2: Edit the files to resolve the conflicts

Step 3: Commit the changes

git add .
git commit -m 'resolved PR #nn merge conflicts'

Step 4: Push the changes to your personal repo

git push origin <feature-branch-name>

Step 5: Confirm that conflicts have been fixed.

Go back to the Github page showing the status of your PR. After the CI tests are run, you should see this message:

This pull request can be automatically merged by project collaborators.

You can’t perform that action at this time.