I have two branches A and B, the difference between those branches that B has some dropped commits from A (other one commits are identical).
When I have make some new commits in branch A I want merge them intro branch B, but left dropped/modificated commits still to be dropped/modificated (in another words: cherry-pick only new commits from A into B).
When I do:
git rebase A
it not only rebase new commits but also resore dropped ones, how to avoid it?
is it possible to achive it using rebase or other ways, maybe possible to indificate same commit in two branches and start cherry picking since it?
Example:
A: 1 2 3 4 5 6
B: 1 7 4
Expected Result A -> B:
A: 1 2 3 4 5 6
B: 1 7 4 5 6
So we keep updating B branch with new commits comming into A branch while B branch modificated copy of A
I have found one solution, idea behind this that we using
A_since_commit = 4 in question above
while we located in A branch. We taken current B branch and took commits since A_since_commit from A branch and rewrite A branch by modificated B branch. Since we don't want to rewrite current branch, we need temporary one.
Solution:
We can also detect last same commit with different ID in parent A branch, so full solution (bash):