Interactive Rebase
To further organise the commits. Include -i
in the command, means interactive.
Interactive rebase is avaialable if
no merged commits involved.
neither branch has initial commit
the rebase branch is not the parent (e.g. rebase
master
tofeature
won't work, but the opposite way will)
The text editor will open for you to select the operations on each commit.
The latest commit comes last on the list.
You can also reorder the commits during an interactive rebase.
Commonly used options
pick
: takes the commit of one branch and puts it at the end of another branch. This is the default option for rebase.reword
: edit the commit message.squash
: combines multiple commits into one.drop
: removes the commit as it never happens.
Last updated