Most tutorials stop at add, commit, and push. But real projects demand more: recovering lost commits, finding the exact change that broke something, and keeping history clean without losing work.
The basic Git workflow—add, commit, push—feels predictable until you join a real team. Branches multiply, production bugs appear, and one wrong command can make hours of work seem to vanish. That's when you realize Git's power extends far beyond the commands in every tutorial. The following ten commands address the scenarios that basic Git doesn't cover: recovering lost work, pausing mid-task, cherry-picking specific changes, and debugging with precision.
Recovering Lost Work
git reflog: Your Safety Net
Accidentally resetting your branch to an earlier commit can make a feature seem permanently gone. But Git keeps a hidden log of every HEAD movement. Run git reflog to see a timeline of those movements. Your 'lost' commits still exist in Git's database. You can recover them by resetting to the commit's hash. This command is why experienced developers rarely lose work permanently.
git stash: Pause Without Committing
When a production emergency interrupts your feature work, you don't want to commit half-finished code. git stash saves your changes and cleans your working directory. After fixing the hotfix, switch back and run git stash pop to restore your work. This keeps your history clean and lets you context-switch smoothly.
Selective and Efficient Changes
git cherry-pick: Apply One Commit
When a bug fix lands on a develop branch but production runs on main, merging the entire branch isn't possible if it contains unfinished features. git cherry-pick <commit-hash> applies just that one commit to your current branch. This is a standard move for hotfixes.
git bisect: Binary Search for Bugs
Hunting down a regression in a repository with thousands of commits can take hours. git bisect performs a binary search. You mark the current commit as bad, an earlier known-good commit as good, and Git checks out the midpoint. You test, mark it good or bad, and Git narrows the range. Within about ten steps you'll pinpoint the culprit commit.
git blame: Understand the Why
When you encounter puzzling code, git blame reveals who changed each line and when. This helps you trace the original commit and understand the intent behind the code—especially useful for legacy codebases.
Managing History
git log --graph: Visualize Branches
Complex branch histories are hard to follow. git log --graph --oneline --all gives a text-based graph of commits and merges, making it easier to see how branches diverged and came together.
git reset: Undo Before Pushing
If you made a commit that shouldn't exist, git reset lets you adjust your local history. Use --soft to keep changes staged, --mixed to unstage them, or --hard to discard everything. Be cautious with --hard—it permanently removes changes. If you've already pushed, consider git revert instead of rewriting history.
git rebase -i: Clean Up Commits
A series of small, messy commits can be cleaned before merging. git rebase -i opens an editor where you can squash multiple commits into one. This keeps the main branch history readable. Avoid rebasing shared branches—use it only on local or feature branches.
Working in Parallel
git worktree: Multiple Branches at Once
Normally you can only have one branch checked out per directory. git worktree add ../hotfix main lets you work on multiple branches simultaneously in separate directories. This is great for handling hotfixes while your main feature branch stays checked out.
git clean: Remove Untracked Files
Build outputs, logs, and other untracked files can clutter your working directory. git clean -n previews what would be removed; git clean -f actually removes them. Always preview first to avoid deleting something important.
Beyond the Basics
These ten commands cover recovery, debugging, and history management. They aren't just tricks—they're tools that solve real problems you'll encounter in professional development. Start with reflog and stash, then gradually incorporate the others into your workflow. Git's depth is what makes it powerful; learning these commands turns it from a source of anxiety into a reliable ally.

