Undo ANY git mistake in 3 seconds with a beautiful TUI
Never lose work again. git-time-machine makes git reflog visual, interactive, and actually usable.
You just:
- ๐ฅ Force pushed and lost commits
- ๐ฅ Did
git reset --hardby accident - ๐๏ธ 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 ๐ฏ
Navigate your git history like a time traveler. One key to restore.
cargo install git-time-machinegit clone https://github.com/dinakars777/git-time-machine
cd git-time-machine
cargo install --path .brew install git-time-machine# Launch in any git repository
git-time-machine
# Show all reflog entries (default: last 50)
git-time-machine --all| Key | Action |
|---|---|
โ / k |
Move up |
โ / j |
Move down |
Enter |
Restore to selected state |
q / Esc |
Quit |
- โ 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โข
# 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
# 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 restoreWhy 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
# Deleted a branch 2 weeks ago
# Need it back but don't remember the commit hash
# git branch -D feature-branch was weeks ago
# With git-time-machine:
git-time-machine --all
# Scroll back through weeks of history
# Find "checkout: moving from feature-branch"
# See the commit hash right there
# Press Enter, then: git checkout -b feature-branchWhy 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
# 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 branchWhy 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
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.
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 deleted branch from 2 weeks ago | git reflog --all | grep branch-name, find hash, git checkout -b, verify |
--all flag, scroll, press Enter |
| 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.
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
MIT ยฉ Dinakar Sarbada
If this saved you once, give it a star! โญ
Made with โค๏ธ and Rust | Report Bug | Request Feature
