git-time-machine
Visual git reflog TUI for undoing git mistakes
🕰️ git-time-machine
Undo DISASTROUS git mistakes in 3 seconds with a beautiful TUI
Never lose work again. git-time-machine makes git reflog visual, interactive, and actually usable.
✨ The Problem
You just:
- 💥 Accidentally moved HEAD and lost track of your commits
- 🗑️ Deleted a branch you needed
- 🤦 Rebased wrong and broke everything
- 😱 Can't remember what you did 5 minutes ago
Current solution: Dig through git reflog, copy cryptic hashes, pray you picked the right one.
Better solution: git-time-machine 🎯
🚀 Demo

Navigate your git history like a time traveler. One key to restore.
📦 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 .
Homebrew (Coming Soon)
brew install git-time-machine
🎮 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 |
🎯 Features
- ✅ Visual Timeline - See your entire git history at a glance
- ✅ Relative Timestamps - "5m ago", "2h ago", "yesterday"
- ✅ One-Key Restore - Press Enter, done
- ✅ Vim Keybindings - j/k navigation
- ✅ Beautiful TUI - Built with Ratatui
- ✅ Lightning Fast - Written in Rust
- ✅ Zero Config - Just works™
🔥 Use Cases
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
# git reflog shows 50+ cryptic entries
# With git-time-machine:
git-time-machine
# Visually scan the timeline
# See "2h ago - before I started messing around"
# Press Enter, back to working state ✨
Why not git reflog? You'd need to:
- Read through cryptic hashes and messages
- Guess which one is "before you broke it"
- Manually
git reset --hard <hash> - Hope you picked the right one
- Repeat if wrong
Scenario 2: Recovering Lost Work After Complex Operations
# You did: rebase, merge, reset, amend, rebase again
# Now you need code from 3 operations ago
# But you don't remember the exact hash
# With git-time-machine:
git-time-machine
# Scroll through visual timeline
# See relative timestamps: "15m ago", "1h ago"
# Find the state you need
# Press Enter to restore
Why not git reflog | grep? You'd need to:
- Know what to grep for
- Parse timestamps manually
- Cross-reference multiple entries
- Still guess which hash is correct
Scenario 3: Accidental Branch Deletion
# Deleted a branch recently but forgot the commit hash
# git branch -D feature-branch
# With git-time-machine:
git-time-machine --all
# Scroll back through your history
# Find "checkout: moving from feature-branch"
# Copy the short hash displayed in the UI
# Hit 'q' to exit, then run: git branch feature-branch <hash>
Why not git reflog --all? You'd need to:
- Scroll through hundreds of lines of text
- Find the right branch name in the noise
- Extract the hash manually
- Remember the git commands to restore it
Scenario 4: "Undo" After You've Already Committed
# You committed to the wrong branch
# Then made 3 more commits
# Then realized the mistake
# git revert won't help - you need to go back in time
# With git-time-machine:
git-time-machine
# Find "before I committed to wrong branch"
# Press Enter
# Cherry-pick the commits to the right branch
Why not git reset? You'd need to:
- Count how many commits back
- Remember if it's
--soft,--mixed, or--hard - Hope you counted right
- Manually re-apply commits if you messed up
⚠️ What Git-Time-Machine Cannot Fix
- Uncommitted Changes: If you haven't committed or stashed your work, the reflog cannot see it. Accidentally running
git clean -fdor wiping uncommitted files viagit reset --hardis permanent. - Garbage Collected Commits: By default, git periodically cleans up unreachable commits. If a commit has been permanently garbage-collected, it is gone forever.
🛠️ How It Works
git-time-machine is a wrapper around git reflog that:
- Parses your reflog history
- Displays it in an interactive TUI
- Lets you preview and restore any state
- Executes
git reset --hard <hash>when you press Enter
It's just git under the hood - no magic, no risk.
🤔 Why Not Just Use Git Commands?
You absolutely can! But here's the reality:
| Task | With git commands | With git-time-machine |
|---|---|---|
| Find state from "before I broke it" | git reflog, scan 50+ lines, guess hash, git reset --hard <hash>, hope it's right |
Scroll, press Enter |
| Recover a deleted branch's commit hash | git reflog --all | grep branch-name, find hash, git checkout -b, verify |
--all flag, scroll, copy hash |
| Undo complex operation sequence | Remember exact commands, count commits, pick right reset flag | Visual timeline, click the "before" state |
| Explore "what if" scenarios | Multiple git reset attempts, risk losing more work |
Navigate freely, restore is one keypress |
git-time-machine doesn't replace git - it makes reflog actually usable for humans who:
- Don't memorize commit hashes
- Don't want to grep through 200 lines of text
- Want to see their history visually
- Need to undo mistakes quickly without googling
Think of it as git reflog with a UI that doesn't require a PhD.
🤝 Contributing
Contributions welcome!
Ideas for future versions:
- Show file diffs inline
- "Panic mode" - undo last N minutes
- Branch visualization
- Stash recovery
- Search/filter commits
- Export timeline as JSON
📝 License
MIT © Dinakar Sarbada
🌟 Star History
If this saved you once, give it a star! ⭐
Made with ❤️ and Rust | Report Bug | Request Feature