GitHistory

git rebase

Replays the current branch's commits on top of another branch, producing a linear history instead of a merge commit.

Syntax

git rebase <branch> | git rebase -i <branch>

Examples

Interactively rebase to squash/reorder commits

git rebase -i HEAD~5

Related commands