Cheatsheets optimize for scanning, not reading. Keep prose to a minimum, lean on tables and short code blocks, and group by task.
Git
| Task | Command |
|---|---|
| Discard local changes | git checkout -- <file> |
| Amend last commit | git commit --amend |
| Undo last commit, keep work | git reset --soft HEAD~1 |
| See what changed | git diff --stat |
Keyboard shortcuts
| Action | macOS | Windows/Linux |
|---|---|---|
| Command palette | ⌘ ⇧ P | Ctrl ⇧ P |
| Quick open | ⌘ P | Ctrl P |
| Toggle terminal | ⌃` | Ctrl` |
Snippets
One-liners worth memorizing:
# Find the biggest files in a tree
du -ah . | sort -rh | head -20
# Watch a command refresh every 2s
watch -n 2 'kubectl get pods'
// Debounce
const debounce = (fn: Function, ms = 300) => {
let t: ReturnType<typeof setTimeout>;
return (...a: unknown[]) => { clearTimeout(t); t = setTimeout(() => fn(...a), ms); };
};
Layout tip: cheatsheets work best with short rows. If a cell needs a paragraph, it belongs in a tutorial instead.