Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

merging develop to release branch

Maybe an easy question for the more experienced in git to answer but i am struggling for some hours now on this.

I have three branches: Develop, MyBranch & Release.

MyBranch extends Develop and since it was a longer feature, Develop was merged into MyBranch again two times. Release is branched off Develop and Develop is ahead of Release (since we still continue to work on features for the next release).

Now i have to merge MyBranch to Develop and to Release. The Merge to Develop didn't have any problems, but i wasn't sure about the merge to Release. Since develop was merged into MyBranch two times, i could by accident merge changes which are not wanted on release. What do i do? I thought about:

  • Checkout new Branch MyBranchRelease
  • Reverting the two merges from Dev into MyBranchRelease
  • Merging Release into MyBranchRelease to solve conflicts
  • Merge MyBranchRelease into Release

Does this make sense? Hope to hear from you guys

like image 211
Julian Dm Avatar asked Oct 20 '25 17:10

Julian Dm


1 Answers

So you have:

          r--r--r (release)
         /
--d--d--d---d--d--d--d--d (Develop)
         \   \     \
          \   v     v
          mb--mb----mb--mb--mb--mb--mb

Since develop was merged into MyBranch two times, I could by accident merge changes which are not wanted on release.

Creating a test branch as you describe is a good tactic except it involves reverting merges

Another approach would be to create MyBranchRelease where MyBranch is, then rebase it on top of release, while dropping the two merge commits.

git checkout MyBranch 
git checkout -b MyBranchRelease 
git rebase -i release
like image 112
VonC Avatar answered Oct 23 '25 06:10

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!