SyntaxStudy
Sign Up
Home Git Reference git rebase

git rebase

command

Reapplies commits on top of another base commit. Creates a cleaner linear history than merge.

Syntax

git rebase <base>

Example

bash
# Rebase feature onto main
git switch feature/login
git rebase main

# Interactive rebase (squash, reorder, edit)
git rebase -i HEAD~3

# Abort rebase
git rebase --abort

# Continue after resolving conflicts
git rebase --continue