I have been trying different approaches of git rebase -i --root
, but they don't seem to do the trick for me.
I have this commit tree:
0 -> 1 -> ... -> 2 -> 3 -> 4 -> 5 -> 9 ...
\
-> 6 -> 7 ...
\
-> 8 ...
and I want to wind up with this:
3 -> 4 -> 5 -> 9 ...
\
-> 6 -> 7 ...
\
-> 8 ...
which is squashing/deleting the first n (which may be hundreds) of commits. The repository has not been pushed anywhere yet.
After trying different kinds of rebases (mainly setting 0
to pick
and 1-3
to fixup
), most of them result in this:
0 -> 1 -> ... -> 2 -> 3 -> 4 -> 5 -> 9 ...
0 -> 1 -> ... -> 2 -> 3 -> 4 -> 6 -> 7 ...
which are completely unrelated to each other and not what I want.
I have tried VonC's approach to the letter but I am obviously missing something.
EDITED
If anyone wants to try out their approach, I have set up a mock repository here: https://github.com/dr01g/gitr-root-rebase.git