Skip to content

Rebase

← All terms · Git fundamentals

A method of integrating changes from one branch to another by moving or combining a sequence of commits to a new base commit.

What it is

Rebasing rewrites commit history by taking the commits from your current branch and reapplying them directly on top of another branch. This creates a clean, linear project history without the extra "merge commits" that standard merging creates. It is powerful but can be destructive if used on shared public branches.

When you would use it

You use rebase to clean up your local commit history or to catch up with the main branch's updates before submitting your code for review.

Common operations

  • Updating a feature branch with the latest changes from the main branch.
  • Squashing multiple small commits into a single cohesive commit before a pull request.

Related terms

Where this is taught

No learning path uses this term yet. Browse the Learning Atlas for guided sequences through related ideas.

Going deeper