interactive rebaseWhat, we're not done?
interactive rebaseWe know that when we rebase we are "replaying" commits
What if we could decide step-by-step what to do with each commit?
interactive rebasegit rebase --interactive
git will then open a heavily commentated file that will specify how the rebase will be done
We are not going to see what every command does, just a few
interactive rebaseCiting the last three lines in the file:
These lines can be reordered; they are executed from top to bottom.
If you remove a line here THAT COMMIT WILL BE LOST.
However, if you remove everything the rebase will be aborted.
interactive rebaseinteractive rebaseinteractive rebaseRember the question we left suspended a while ago?
What if we do not want to add our changes to the last commit?
fiuxp commits to the rescue
interactive rebase
commit has the very helpful
--fixup <sha> option:
It will create a commit with a standard commit message. During a rebase, we can tell git to auto-merge it for us!
interactive rebase
To tell git to auto-merge fixup commits
we need to pass --autosquash to
rebase
interactive rebaseYes, it is.
Fixups are much more maintainable since with a simple option they can be merged into their respective commits
Just don't push them