🕰️

git-time-machine

Undo git mistakes in 3 seconds

Visual git reflog that makes sense.

⭐ Star on GitHub
git-time-machine demo

Navigate your git history like a time traveler. One key to restore.

You just broke everything

🔥

Force pushed

Lost commits you needed

💥

git reset --hard

By accident, of course

🗑️

Deleted a branch

The one you actually needed

🤦

Rebased wrong

Everything is broken now

Current solution:

$ git reflog
a1b2c3d HEAD@{0}: commit: Fix bug
e4f5g6h HEAD@{1}: reset: moving to HEAD~1
i7j8k9l HEAD@{2}: commit: Add feature
m0n1o2p HEAD@{3}: checkout: moving from main to feature
q3r4s5t HEAD@{4}: commit: Update docs
... 45 more cryptic entries ...
$ # Which hash do I need? 🤷

Dig through cryptic hashes, guess which one is right, pray it works.

Better: git-time-machine 🎯

❌ With git reflog

  1. Read through cryptic hashes
  2. Guess which one is "before you broke it"
  3. Manually git reset --hard <hash>
  4. Hope you picked the right one
  5. Repeat if wrong

⏱️ 5-10 minutes + stress

✅ With git-time-machine

  1. Run git-time-machine
  2. Scroll through visual timeline
  3. Press Enter

⏱️ 3 seconds

Features

📊

Visual Timeline

See your git history at a glance

Relative Timestamps

"5m ago", "2h ago", "yesterday"

One-Key Restore

Press Enter, done. No copying hashes, no commands

⌨️

Vim Keybindings

j/k navigation for the keyboard warriors

🎨

Beautiful TUI

Built with Ratatui

🚀

Lightning Fast

Written in Rust

Real-World Scenarios

Scenario 1: "I Don't Know What I Did, But It's Broken"

You ran a bunch of git commands, something broke, you don't remember the exact sequence.

Run git-time-machine
Visually scan the timeline
See "2h ago - before I started"
Press Enter ✨

Scenario 2: Recovering Lost Work After Complex Operations

You did: rebase, merge, reset, amend, rebase again. Now you need code from 3 operations ago.

Scroll through visual timeline
Find "15m ago", "1h ago"
Press Enter to restore

Scenario 3: Deleted Branch (Weeks Ago)

Deleted a branch 2 weeks ago, need it back but don't remember the commit hash.

git-time-machine --all
Scroll back through weeks
Find "checkout: moving from feature-branch"
Press Enter

Installation

Cargo (Recommended)

cargo install git-time-machine

From Source

git clone https://github.com/dinakars777/git-time-machine && cd git-time-machine && cargo install --path .

Usage

# Launch in any git repository
git-time-machine

# Show all reflog entries (default: last 50)
git-time-machine --all

Controls

Key Action
/ k Move up
/ j Move down
Enter Restore to selected state
q / Esc Quit

Stop losing work

Just git under the hood.