Reputation: 7962
We had a branch a
. Someone needed to improve functionality B
they were planning on working on by using a function from a
. So they branched out from a
with branch b
. Then, someone wanted to improve specific functionality in a
to get a qualitative boost in performance of B
so they branched out from b
and created c
.
My question is, what's the best way to get all the changes specifically add in c
and put them in a
without any changes from b
.
Should you use Cherry Pick in cases like this? Is there a superior way to accomplish this? Could this result in a messy error in git?
Upvotes: 2
Views: 318
Reputation: 1329032
One cleaner way would be to branch c
from a
, not b
.
And then merge c
to a
and rebase b
on top of a
(or rebase b
on top of c
, while c
isn't yet merged on a
).
If you branch c from b and cherry-pick, you might have issues later on when you will merge b (which might include c enhancement) to a.
That is because cherry-picking can introduce duplicate commits and/or functional dependencies.
You generally cherry-pick from one branch to another when you know you will never merge that "one branch" anyway.
Upvotes: 1