What non-interactive Git command(s) achieve the change from Before to After in each case?
1a. Reparenting I
Before:
A---B---C---D
After:
C'---D'
/
A---B
1b. Reparenting II
Before:
C---D
/
A---B
After:
C
/
A---B---D'
1c. Reparenting III
Before:
C
/
A---B---D
After:
C---B'---D'
/
A
These all look like applications of git rebase --onto
.
Before:
A---B---C---D
After:
C'---D'
/
A---B
Set up branches to label the particular commits and then rebase onto.
git checkout -b ex1a-b B
git checkout -b ex1a-d D
git checkout -b ex1a-a A
git rebase --onto ex1a-a ex1a-b ex1a-d
Before:
C---D
/
A---B
After:
C
/
A---B---D'
Creating branches is similar to the above: git rebase --onto ex1b-b ex1b-c ex1b-d
.
Before:
C
/
A---B---D
After:
C---B'---D'
/
A
Again with the branches, but now just git rebase ex1c-c ex1c-d
.
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