Gitflow
🦴Rebase Ate My Commits!Hard+750 XP
Workshop
Scenario reference

Rebase Ate My Commits!: the situation, step by step

The situation

You rebased onto main without fetching first. Two teammate commits that landed on your branch yesterday are gone.

Reflog has every commit your branch tip touched in the last 90 days.

Hard · 3 steps · +750 XP

What you will practice

This scenario walks through 3 steps, in order:

  1. 01Inspect the reflog to find the pre-rebase tip
  2. 02Create a rescue branch from the lost tip
  3. 03Cherry-pick the missing commits back
Reveal the step-by-step commands

Try the terminal first — you learn more by doing. When you want to check yourself, here is the command for each step.

  1. 1. Inspect the reflog to find the pre-rebase tip
    git reflog
  2. 2. Create a rescue branch from the lost tip
    git branch rescue HEAD@{4}
  3. 3. Cherry-pick the missing commits back
    git cherry-pick rescue~1 rescue

Key takeaway

Reflog → branch from missing tip → cherry-pick or merge back.