# Resolving merge conflicts When the target branch (e.g. `master`) has moved ahead of your MR branch, GitLab will report a conflict and the MR cannot be merged until it is resolved. ## Simple rebase using the GitLab UI In many cases GitLab can rebase your branch automatically. Open your Merge Request and click the **Rebase** button. If the rebase is successful, the MR is updated and ready for review. If it fails, GitLab will ask you to resolve the conflicts manually. ## Manual rebase When the GitLab UI rebase is not enough, resolve conflicts locally and push the result. ### 1. Get the latest code from the target branch ```bash git checkout master git pull origin master ``` ### 2. Switch to your MR branch and rebase ```bash git checkout git rebase master ``` ### 3. Resolve conflicts For each file with conflicts, open it in your editor, resolve the conflict markers, and stage the file: ```bash git add ``` Use `git status` to confirm all conflicts are resolved before continuing. ### 4. Continue the rebase ```bash git rebase --continue ``` Repeat steps 3–4 for each conflicting commit. Use `git rebase --abort` to cancel the whole operation at any point. ### 5. Push the rebased branch Since the rebase rewrites history, a regular push will be rejected. Use `--force-with-lease` to push safely: ```bash git push --force-with-lease ``` **Note:** `--force-with-lease` rejects the push if someone else has pushed to the same branch in the meantime, preventing accidental loss of their work.