Beyond Add, Commit, Push

Most developers use maybe 5% of Git’s power. These 10 commands separate senior devs from juniors.

1. git stash with names

git stash push -m "WIP: auth feature"
git stash list
# stash@{0}: On main: WIP: auth feature
git stash pop stash@{0}

2. git bisect β€” Find the breaking commit

git bisect start
git bisect bad          # Current commit is broken
git bisect good abc123  # This old commit worked
# Git binary-searches through commits
# Test each one, mark good/bad
git bisect good  # or: git bisect bad
# ... repeats until it finds the exact breaking commit
git bisect reset

3. git worktree β€” Multiple branches simultaneously

git worktree add ../hotfix hotfix-branch
# Now you have two working directories, no stashing needed
cd ../hotfix
# Fix the bug, commit, push
git worktree remove ../hotfix

4. git reflog β€” Undo almost anything

git reflog
# See EVERY state your HEAD has been in
git reset --hard HEAD@{3}  # Go back to that state

5. git log --oneline --graph

git log --oneline --graph --all --decorate
# Beautiful ASCII branch visualization

6. git commit --fixup

git commit --fixup abc123
git rebase -i --autosquash main
# Automatically squashes fixup commits into the right place

7. git cherry-pick

git cherry-pick abc123 def456
# Apply specific commits from another branch

8. git diff --stat

git diff --stat main..feature
# Quick summary: which files changed and how much

9. git clean -fdx

git clean -n   # Preview what will be deleted
git clean -fdx # Remove all untracked files and directories

10. git rebase -i (Interactive Rebase)

git rebase -i HEAD~5
# Reorder, squash, edit, or drop last 5 commits
# pick β†’ squash β†’ reword β†’ done

Master these and you’ll never fear git again.