Rebase vs Merge, Without the Holy War
Everyone has opinions about git rebase vs git merge. Here’s a rule of thumb
that has served me well.
The short version
- Rebase your local, unpushed work to keep history linear and clean.
- Merge when integrating shared branches that others have based work on.
# clean up your local branch before opening an MR
git rebase main
# integrate a reviewed feature branch
git merge --no-ff feature/login
The golden rule: don’t rebase commits that other people already pulled. Rewriting shared history is how you ruin a Friday afternoon.