I want to do something similar to what the standard interactive rebase does, but I want to use it just to clean up my branch’s history and not pull in any updates from another branch. So, I want to keep the ‘branching point’ the same. For example, if my branch is B1:
--O--O--O--O--O--O------O--O----O--O master
\
O---O--x--x--x--O--O--x--x--O B1
In the above diagram, O is a clean commit and x is a messy commit I want to squash with the ones before it and maybe change the commit message. With a normal interactive rebase on master I could get this:
--O--O--O--O--O--O------O--O----O--O master
\
O---O--X--O--O--X--O B1
Where X is messy commits squashed together with a cleaned up commit message. But how can I get the below?
--O--O--O--O--O--O------O--O----O--O master
\
O---O--X--O--O--X--O B1
You can rebase on any commit, not just on
master‘sHEAD. Let’s say your branch point ofB1is12345, then you can interactively rebaseB1on that commit withThen cleanup the history.
See
git help rebasefor more pointers.