git-rebase
Reapply commits on new base
TLDR
Rebase onto branch
SYNOPSIS
git rebase [options] [upstream] [branch]
DESCRIPTION
git rebase reapplies commits on top of another base tip, producing a linear project history. It finds the common ancestor of the current branch and the upstream, then replays each commit from the current branch onto the upstream tip.
Interactive mode (`-i`) allows reordering, squashing, editing, or dropping commits during the replay, making it a powerful tool for cleaning up commit history. The `--onto` option enables advanced workflows like moving a branch to an entirely new base. Autosquash automatically applies fixup! and squash! commits, supporting the iterative fixup workflow.
PARAMETERS
-i, --interactive
Interactive mode.--onto newbase
Rebase onto different base.--continue
Continue after resolving.--abort
Cancel rebase.--skip
Skip current patch.--autosquash
Auto-apply fixup/squash.--autostash
Auto-stash changes.-x cmd
Run command after each commit.-p, --preserve-merges
Preserve merge commits.
CAVEATS
Rebasing rewrites history. Don't rebase commits that have been pushed to shared branches.
SEE ALSO
git-merge(1), git-cherry-pick(1)
