0

I have a master branch with multiple child branches. Each child branch has a small difference compared to the master branch. I often run into the case that I update my master branch and would like the child branches take that update/commit as well. How do I accomplish this is a good clean way?

Currently I am using Gitkraken for this case, so solutions with Gitkraken are welcome as well.

i.do.stuff
  • 207
  • 3
  • 11
Jon not doe xx
  • 533
  • 3
  • 10
  • 20

2 Answers2

1

If you want all master commits to be merged

git checkout feature/my-feature-branch1
git merge master

You can also consider rebasing instead of merging, for keeping the history clean.

If you want only to apply a subset of commits from master to the branches

git log # For figuring out the SHA-1 hashes you want to apply
git checkout feature/my-feature-branch1
git cherry-pick <SHA-COMMIT-1> <SHA-COMMIT-2> <SHA-COMMIT-N>

Repeat for all branches you need

everton
  • 7,579
  • 2
  • 29
  • 42
  • Hi I want to Keep the branch alive I want to push all changes I made on my master branch into my other branches aswell – Jon not doe xx Dec 21 '18 at 14:10
  • @Jonnotdoexx both approaches will keep your branches separate and master intact and unaware of their changes. – everton Dec 21 '18 at 14:33
  • ok I think I got confused since the gui is showing the other branch in the same "line" as the master but that is ok since ist the same codebase – Jon not doe xx Dec 21 '18 at 15:05
  • Look at the commit tree, you should be able to figure out if the correct commits are in the right branches just by following the nodes – everton Dec 21 '18 at 19:20
0

You can use cherry pick to move your commits

strg
  • 116
  • 3
  • 7