Git Rebase
Properties
created
15.03.2026, 00:00
modified
Empty
published
Empty
sources
git-rebase docs · Merging vs. Rebasing
topics
Git, Rebase
authors
Empty
ai-assisted
Yes
Rebasing re-applies commits on top of another base, rewriting history to produce a linear commit graph. See also Merging vs rebasing for a conceptual comparison with merging.
# Commands
# Basic Rebase
| |
# Interactive Rebase
| |
Interactive actions available per commit:
pick— keep commit as-isreword— keep commit, edit messageedit— pause to amend the commitsquash— meld into previous commit, combine messagesfixup— meld into previous commit, discard messagedrop— remove commit entirelyexec— run a shell command after the commit
# Conflict Resolution
| |
# Autosquash
| |
# Notes
- Never rebase public/shared branches — rewrites history and diverges others’ copies (Merging vs rebasing)
--ontois useful for moving a stack of commits to a completely different base- Interactive rebase is the primary tool for cleaning up local commit history before a PR