cod-ai.com

Git Commands Cheat Sheet: The 20 Commands You Actually Use

Published 2026-03-16 · cod-ai.com Team

Git has 150+ commands. You use maybe 20. Here they are.

Daily Commands

git status — what changed? git add . — stage everything. git commit -m 'message' — save changes. git push — upload to remote. git pull — download latest.

Branching

git branch feature-x — create branch. git checkout feature-x — switch to branch. git checkout -b feature-x — create and switch. git merge feature-x — merge into current branch. git branch -d feature-x — delete branch.

Recovery

git stash — temporarily shelve changes. git stash pop — restore shelved changes. git reset --hard HEAD~1 — undo last commit (destructive!). git revert HEAD — undo last commit (safe, creates new commit).

Investigation

git log --oneline -10 — last 10 commits. git diff — see unstaged changes. git blame file.js — who changed each line? git show commit-hash — see a specific commit.

Need help writing git commands? Our code assistant handles git questions too.

Try our tools for free

Explore All Tools →