2 min read

Cheatsheet · dense quick reference

Table of Contents

Cheatsheets optimize for scanning, not reading. Keep prose to a minimum, lean on tables and short code blocks, and group by task.

Git

TaskCommand
Discard local changesgit checkout -- <file>
Amend last commitgit commit --amend
Undo last commit, keep workgit reset --soft HEAD~1
See what changedgit diff --stat

Keyboard shortcuts

ActionmacOSWindows/Linux
Command palette PCtrl P
Quick open PCtrl 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.