Home > Net >  How can I so a "cascading" merge from an upstream branch and pass the merge to all downstr
How can I so a "cascading" merge from an upstream branch and pass the merge to all downstr

Time:02-28

I got a "Parent" branch. Branch A is a branch of Parent, Branch B is a branch of Branch A and Branch C is a branch of Branch B:

------ Parent
  \----Branch A
     \------ Branch B
        \------- Branch C

I want to merge some changes into Branch A and then pass those same changes onto Branches B and C. Is there a way this can be done easily? Perhaps I can use the --contains mechanism which lists the contained branches and do this with bash? I googled for a solution like that but didn't find one.

CodePudding user response:

My usual approach is to rebase A onto its parent, then B onto A, and C onto B.

Unfortunately, Git won't do this for you. You could write a script using git branch --contains recursively.

  • Related