In the history below, assume that commits B
through E
are completely independent from commits F
through I
.
br-1 master
⋯ ---A---B---C---D---E---F---G---H---I
How do I end up with a history that looks like this:
master
⋯ ---A---F'--G'--H'--I'
\
`-B---C---D---E
br-1
?
br-1
and master
are meant to be branches. The prime in F'
is meant to indicate that commit F'
consists of exactly the same changes as those that went into commit F
. Similarly for G'
, H'
, and I'
.
(The desired operation is, effectively, the inverse of doing git rebase br-1
from master
, starting from the second history shown above.)
Two options.
1)
git checkout master
git rebase --interactive A
Delete the lines for B through E
2)
git checkout master
git rebase --onto A E
With master
checked out:
git rebase --onto A br-1 master
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With