← Back to Tools

Git Command Wizard

Broke something? Pick your problem → get the exact fix. No Googling, no guessing.

Git Safety Rules — Before You Run Anything

Half of Git panic comes from running commands without understanding what they do. Here's the cheat sheet.

Always check status first

Run git status and git log --oneline -5 before any undo operation. Know your current state before changing it.

--hard = data loss risk

Any command with --hard discards uncommitted changes permanently. There's no Ctrl+Z. If unsure, stash first: git stash.

Never force-push to main/master

git push --force on a shared branch rewrites history for everyone. Use --force-with-lease at minimum — it fails if others have pushed since you last pulled.

Reflog is your safety net

Git keeps a local log of every HEAD move for ~90 days. Run git reflog to find any commit you think you've lost — then git checkout <hash>.