Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I solve merge conflicts on a protected branch?

Tags:

git

I have a branch that's branched of a master branch. It's more of a release branch, if you will. This release branch is protected.

master ---> release

and from this release branch, I've been branching my features off of it and merging it in:

master ---> release <--- features

now once my features are into this release branch, there are merge conflicts. Herein lies my problem. I know how to solve conflicts were it not a protected branch, but I'm not sure how to solve it otherwise.

What I've tried doing was something like this:

master ---> release ---> release-fix

and in release-fix, I would rebase from master and push it up, and make the base of that PR to be the release branch. However when I make the PR, it says it's still unable to automatically merge. Is this the right way to do something like this?

like image 978
nyphur Avatar asked Dec 11 '19 20:12

nyphur


1 Answers

I think there are multiple ways to do this, one being Dherik's answer. I typically do the opposite:

  1. git fetch # get copy of latest everything
  2. git checkout -b merge-release-into-master origin/master --no-track # create a new branch off of master
  3. git merge origin/release --no-ff # merge in the release branch
  4. Resolve all the conflicts and commit.
  5. push -u merge-release-into-master # Push out your new merge-release-into-master branch and PR it into master. Now it should go cleanly.

As a side note, are multiple people merging into master in this way (multiple release or hotfix branches simultaneously)? If no, I'm not sure how you're getting merge conflicts in the first place from release into master.

like image 145
TTT Avatar answered Nov 15 '22 10:11

TTT