---
title: "How to fix Merge Conflicts"
---

> Documentation Index
> Fetch the complete documentation index at: https://contribute.freecodecamp.org/llms.txt
> Use this file to discover all available pages before exploring further.

# How to fix Merge Conflicts

## 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:

   ```bash
   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:

   ```bash
   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

   ```bash
   git push --force origin <pr-branch>
   ```

Source: https://contribute.freecodecamp.org/how-to-fix-merge-conflicts/index.mdx
