Most developers are familiar with the basic Git commands—clone
, commit
, push
, and pull
. But Git has a lot more to offer under the hood. In this post, we’ll look at 7 underrated Git commands that can level up your version control game, streamline your workflow, and help you avoid common headaches.
1. git stash
Temporarily save your uncommitted changes without committing them:
git stash
Useful when you need to switch branches but aren’t ready to commit yet. Later, bring your changes back with:
git stash pop
2. git bisect
Find the exact commit that introduced a bug using binary search:
git bisect start
Mark the current commit as bad, and a known good commit:
git bisect bad
git bisect good <commit-hash>
Git will then walk you through testing until it finds the problematic commit. Super helpful for debugging regressions.
3. git reflog
Track every change you've made—even those that aren't in your visible history:
git reflog
This is a lifesaver when you think you’ve lost a commit or want to recover a branch after a reset.
4. git cherry-pick
Apply a specific commit from one branch to another:
git cherry-pick <commit-hash>
Great for hotfixes or quickly grabbing small changes without merging whole branches.
5. git blame
Find out who last modified each line of a file:
git blame <file>
Perfect for tracking down context or history behind a piece of code.
6. git clean
Remove untracked files from your working directory:
git clean -fd
Cleans up everything that isn’t part of the repo. Use with caution—but it’s amazing for resetting a cluttered workspace.
7. git shortlog
Generate a summary of commits grouped by author:
git shortlog -s -n
Useful for seeing contributions, especially in open-source projects or during team retros.
Final Thoughts
Git is powerful, and these lesser-known commands can seriously boost your efficiency and control over your codebase. Try adding a few of these into your daily workflow and see how much smoother things get.