3

After a tfs migration (totally different concept of branches) I have to merge fixes to multiple release branches, but the branches are not identical, they are mostly similar, but different products(eg different branding, conn strings etc. ), so i can't use nvie gitflow one product branching strategy here.

enter image description here

https://github.com/MrKekson/stackoverflow_question/network

here you can find a greatly simplified branch structure, and basically I want to merge the hotfix1 branch from b1, to tesztb3, but without the previous commits on b1 (c3, c4).

Cherrypicking or rebase could help, but i did not managed to get it done, and i did not have a lot of experience in advanced git usage yet. So please advise me on how to do it, or what should i change to get it done.

MrKekson
  • 720
  • 6
  • 18
  • 1
    You should also mention what exactly you tried already. Cherrypicking is most probably what you want, but you should state which cherrypicking and rebasing commands you tried and why they did not yield the expected result. – Vampire Nov 23 '16 at 15:58

1 Answers1

0

Ok, i solved it. There are at least a few ways to do it:

So basically, one can cherry-pick every commit separately on hotfix1 to teszt3, but it's clumsy.

So we can either create a merge branch from b1, merge hotfix1 into it, then cherry-pick the commit created by the merge into tesztb3, what will yield a new commit on testb3. One can even add -x to the cherry-pick, so itt will create a note on the new commit, with it's parents guid, alternatively we can squash our hotfix1 branch into 1 commit, and then cherry-pick that.

Or we can create a rebase branch based on the the last commit(hf2), then

git rebase --onto <new-parent> <old-parent> <lastcommit> 

--onto explained here, but <new-parent> is our target branch teszt3, i prefer creating a merge branch for this on the target branch, old parent is the start of hotfix1, and lastcommit in this case is hf2 on hotfix1. Then merge teszt3 to our new merge branch, and create a pull request back to teszt3.

So i think neither path is easy at first look, but doable with a bit experience, and event this is a way smoother experience then renaming a directory in tfsvc.

MrKekson
  • 720
  • 6
  • 18