Git cheat sheet walkthrough: the 20 commands that cover real daily work — status, staging, branching, rebase and stash.
▶ Full written tutorial (free): https://generalistprogrammer.com/tuto...
Git ships with over 150 commands. You will never use most of them. Working
developers get through an entire career on about 20 — and on a normal day, more
like 6. This is the short list: the git commands you actually use, each one with
the real scenario where you reach for it, plus the aliases that turn them into
two or three keystrokes.
What's covered:
The Daily 6 (the everyday loop): git status (what changed / what's staged),
git add FILE and git add -p (stage a file, or pick changes hunk by hunk),
git commit -m "message" (record what's staged), git push (send commits to the
remote), git pull (fetch PLUS merge — not just a download; use --rebase to keep
history linear), and git log --oneline --graph with git diff and
git diff --staged (see history and changes).
The branching set: git branch (list) and git branch NAME (create), git switch
NAME (modern) which equals git checkout NAME (older), git switch -c NAME or
git checkout -b NAME (create and move in one step), and git merge NAME (merge a
branch into the current one).
Rebase vs merge: git merge preserves history and adds a merge commit; git
rebase main replays your commits on top of main for a clean linear history, but
it REWRITES commit hashes — so never rebase commits others already have. Use
git pull --rebase for a clean daily pull.
git stash: shelve uncommitted work for a clean working tree (git stash),
reapply and drop it (git stash pop), and see everything shelved (git stash list)
— perfect for switching branches with unfinished work.
Aliases: git config --global alias.st status turns git st into git status.
Common ones: st = status, co = checkout, br = branch, lg = log --oneline --graph.
Set once, saved to your global config forever.
Free git cheat sheet (every command here):
https://generalistprogrammer.com/tuto...
Also see how to undo a git commit:
https://generalistprogrammer.com/tuto...
Want to go further? Git and GitHub Mastery Pack, 15 dollars, optional:
https://generalistprogrammer.gumroad....
— Chapters —
0:00 The 80/20 of git
1:19 The Daily 6
3:00 The branching set
4:34 Rebase vs merge
6:18 git stash
7:45 Aliases
9:11 Recap — the 20 in one frame
#git #github #gitcommands