QamoosTech
Git & CollaborationIntermediate

Interactive Rebase

PronunciationIN-ter-AK-tiv RE-bays

Definition

A Git feature that lets you modify, combine, or reorder commits in your local branch history before sharing them with others.

Where you hear it

During code cleanup, preparing pull requests, or rewriting git history.

Examples

  • We use interactive rebase to squash multiple tiny bugfix commits into one clean commit.
  • Run git rebase -i HEAD~3 to modify your last three local commits.
  • Interactive rebase lets me squash the three fix-up commits before I open the pull request.

Common mistake

Using interactive rebase on commits that have already been pushed to a shared public branch, which disrupts other team members.

Don't confuse with

Interactive rebase is often confused with git merge; while merge creates a new commit that joins two histories, interactive rebase rewrites the commit history linearly to keep it clean.

Say it at work

  • In a meeting or chatI'm going to run an interactive rebase to clean up these messy commits before I push my branch.
  • In an email or ticketPlease perform an interactive rebase to squash your fixup commits into a single logical unit before we merge this PR.