Kamran Mushtaq
Back to Git
Git

Rebase and Merge

Added: July 25, 2026

Definition

Moves your commits onto the latest main branch and merges them without combining them.

The Problem That Led to It

Some projects need every commit because each represents a meaningful step (feature, bug fix, refactor). Squashing would lose that detail.

What Problem It Solves

Preserves complete commit history while avoiding an extra merge commit.

What Happens If Not Used

You may either lose useful history (squash) or create extra merge commits (regular merge).

Easy Wording

"Keep every chapter of the story, but arrange them neatly."

Layman Example

Instead of submitting only the final report, you also keep every revision for future reference.

Technical Example

Before

main: A B

feature: C D E

After Rebase & Merge

A B C D E

Limitation

Rebasing can become confusing if multiple people modify the same commits.

Solution

Cherry-pick lets you copy only selected commits instead of an entire branch.