git rebase -i

9.4. git rebase -i#

With git rebase -i you can rewrite the history of a single branch (see the Rewriting History). In particular you can clean up a history by squashing several commits into a single commit.

It can be used to get the references of previous stages, including those that did not make it into the history.