Reputation: 3
I have the following tree:
branch1 G---H---I
/
master A---B---C---D---E---F
\
branch2 M---N---O
I need to make some modifications in B. Is there any easy way to spread the modifications to all the branches (master, branch1 and branch2) ?
Upvotes: 0
Views: 113
Reputation: 3483
The safest way to do this is:
Create a new branch from B
git checkout -b BPRIME SHA_OF_B
Make some changes, and commit them. you're graph will look like:
BPRIME B'
/
branch1 / G---H---I
/ /
master A---B---C---D---E---F
\
branch2 M---N---O
Then cherry pick the commits from BPRIME to each of the branches.
$ git checkout branch1 && git cherry-pick B'
$ git checkout master && git cherry-pick B'
$ git checkout branch2 && git cherry-pick B'
This is the safest option because you are not changing the history.
Upvotes: 3
Reputation: 5327
Make the new commit in master branch and then rebase the other branches with the master.
Upvotes: 0