When a branch is protected (such as the main, master, or release branch), you cannot push directly to it. This means if you have a merge conflict related to that branch, you cannot push your conflict resolutions directly to the protected branch.

Steps to resolve conflicts with a protected branch:

  • Merge your source (feature) branch into this new branch:

    git merge <your-feature-branch>

    Resolve any conflicts locally by editing conflicted files, then:

    git add <resolved-files>
    git commit

  • Push this temporary conflict-fix branch to remote:

    git push -u origin conflict-fix

  • Create a new merge request / pull request from conflict-fix branch into the protected branch
  • Review and merge this new MR, which now contains the conflict resolutions.

Leave a comment