You're Using 10% of Git
Most developers know add, commit, push, pull, and maybe merge. That's about 5 commands out of 150+.
But the real power of Git is in the commands you're probably not using: reflog for recovering lost commits, bisect for finding bugs, stash for context switching, and worktree for working on two branches simultaneously.
Here's every Git command and pattern you actually need, organized by when you use them.
Daily Workflow — Every Single Commit
Before every commit, you should be running at minimum:
git status # What changed?
git diff # Review actual code changes
git add -p # Stage changes interactively
git commit -m "feat(scope): description"
git log --oneline -10 # Verify history
git pull --rebase # Sync before push
The biggest mistake? git add . — this stages everything including files you didn't mean to commit. Use git add -p and review each hunk.
Branch Strategy
git checkout -b feature/name # Always branch from main
git push -u origin feature/name # Set upstream tracking
git branch --merged # Find branches safe to delete
git branch -d feature/name # Delete after merge
Cleanup command: git branch --merged | grep -v main | xargs git branch -d
Rebase vs Merge
- Rebase: Feature branches before merging to main (clean history)
- Merge: Long-running branches with multiple contributors
Golden rule: Never rebase commits pushed to a shared branch.
git rebase -i HEAD~5 # Interactive: squash, reorder, edit
git rebase --continue # After resolving conflicts
git rebase --abort # Cancel if things go wrong
The Safety Net — Undo Anything
These commands have saved me more times than I can count:
git stash # Temporarily shelve changes
git stash pop # Restore them
git reset --soft HEAD~1 # Undo commit, keep changes staged
git reflog # Find ANY commit you've ever made
git cherry-pick <hash> # Apply specific commit to current branch
git reflog is the most underrated command. It records every HEAD movement. If you accidentally git reset --hard and lose work, check the reflog — your commits are still there.
Disaster Recovery
git fsck --lost-found # Find dangling commits and blobs
git clone --mirror url # Full backup of remote repo
git clean -fd # Remove untracked files (careful!)
git reflog | head -20 # Check before nuking anything
Pre-Push Checklist
Before every push:
- [ ] All tests pass locally
- [ ] No debug statements committed
- [ ] Conventional commit messages
- [ ] Rebased on latest main
- [ ] No sensitive data in commit
- [ ] CI pipeline green
Why This Matters
Every senior engineer I know has a muscle memory for these commands. They don't google "how to undo git commit" — they just type git reset --soft HEAD~1 without thinking.
If you want a printable checklist with all 47 commands organized by workflow, I put one together that covers daily workflow, branching, merging, undoing mistakes, rebase patterns, collaboration, disaster recovery, and the pre-push checklist.
47 commands. Print it. Keep it next to your keyboard.
What Git commands do you use daily that aren't on this list? Drop them in the comments — I'm always learning new patterns.
Top comments (0)