QamoosTech
Git & CollaborationIntermediate

Rebase

Pronunciationree-BAYS

Definition

Moving your branch's commits on top of the latest commits of another branch, to keep a clean, straight history.

Where you hear it

Git workflows and interviews.

Examples

  • Rebase your branch on main before opening the PR.
  • Never rebase a branch that others already use.
  • After the rebase, the feature branch sits on top of the latest main.

Common mistake

Rebasing shared branches. It rewrites history and breaks your teammates' copies.

Don't confuse with

Rebase rewrites the commit history to create a linear path, while merge preserves the exact history by combining branches with a new commit.

Say it at work

  • In a meeting or chatLet's quickly rebase our feature branches to pick up the latest bug fixes from main.
  • In an email or ticketPlease rebase your branch on top of the latest development branch and resolve any conflicts before requesting a review.