Reputation:
I have in git 2 branches, which contain following commits:
commits in branch a:
A -> B -> C -> D -> ... -> N
commits in branch b:
A -> B -> X -> C -> D -> ... -> N
The difference between branch a
and b
is that branch b contains one more commit, commit X. I want both branches stay the same except that commit X. So when now I commit something to branch a
, I always have to cherry-pick it into branch b
. Is there any smarter solution how to solve this issue in git? Because cherry-picking all the future commits I do not consider as a good idea.
Upvotes: 0
Views: 66
Reputation: 18901
What I'd do is to move commit X
to the head of branch b
. In this case when branch a
gets new commits in, you can simply do:
git checkout b
git rebase a
One obvious caveat though: you cannot rewrite the history in branch a
. This assumes that you keep adding commits on top of a
.
Upvotes: 1