Skip to content
Contribute | freeCodeCamp.org

How to fix Merge Conflicts

Updated

Conflicts on a Pull Request

Conflicts can arise because many contributors work on the repository, and changes can break your PR which is pending a review and merge.

Since we squash all commits, you may not need to do a rebase. However, if a rebase is requested, follow these steps to rebase your PR branch onto main:

  1. Rebase your local copy:

    git checkout <pr-branch>
    git pull --rebase upstream main
  2. If the rebase stops because of conflicts, edit the affected files to resolve them and remove the conflict markers. Stage each resolved file and continue the rebase:

    git add <resolved-file>
    git rebase --continue

    Repeat this step if Git encounters more conflicts, until the rebase completes.

  3. Push back your changes to the PR

    git push --force origin <pr-branch>
Contribute | freeCodeCamp.org

Type to search…

↑↓ navigate↵ selectEsc close