Watch: Get back code I thought I lost in Git | Vovy

Watch Vovy do it on a Mac: "I reset my branch and lost yesterday's work, get it back". Vovy digs through Git's reflog, a hidden log of everywhere your branch has been, to find lost commits or deleted branches and restore them.

"I reset my branch and lost yesterday's work, get it back"

Vovy digs through Git's reflog, a hidden log of everywhere your branch has been, to find lost commits or deleted branches and restore them.

What happens in the video

  1. Stop and do no harm: Vovy pauses any further resets or cleanups. Lost commits usually still exist for weeks, as long as nothing prunes them.
  2. Read the reflog: Vovy runs git reflog, which records every move your branch made, and shows it as a timeline card.
  3. Find the lost work: Vovy previews the commits before your mistake and shows their diffs so you can point to the right one.
  4. Restore to a safe branch: Vovy creates a new branch at that commit, so your current state stays untouched while you check the recovered code.
  5. Back it up on GitHub: Vovy pushes the rescue branch and shows a card of what was recovered and how to merge it back.
Read the step-by-step guide