Repaso
Español
Design & PracticesIntermediateDP-24

Why should you avoid git rebase on a branch others have already pulled?

Options

  1. Rebase deletes the branch that it is applied to
  2. Rebase rewrites history, so collaborators' copies diverge (Correct option)
  3. Rebase is always much slower than a merge of the branch
  4. Rebase cannot resolve conflicts, so a merge is needed

Answer

Rebase rewrites commit history; collaborators' copies diverge and force-pushes can lose their work

Why

Rebase re-creates your commits on top of another branch. They get NEW commit IDs, so the history is rewritten.

If teammates already have the old commits, their copies no longer match, and a force-push can wipe out work they built on top.

Rule: rebase freely on your own local branch; on shared branches, merge instead.

Remember

Never rewrite history others already have.

Key terms

Practice this question in Repaso