1. Cheat sheets
  2. Developer Foundations

5 minReference

Developer workflow cheat sheet

The Developer track on a few screens: the terminal commands you will type most, the Git command for what you want to do, the VS Code shortcuts worth your fingers, the JavaScript traps that catch everyone, the words engineers use, and what to read next. Each row links to the lesson that explains it. Keep it open in a tab while you work.

Terminal: "I want to..."

bash and zsh (macOS, Linux and Git Bash on Windows) take the same commands; PowerShell differs. On Windows, Git Bash keeps your commands the same as your teammates' and CI's (The terminal without fear).

I want to...bash / zsh / Git BashPowerShellLesson
See which folder I am inpwdGet-LocationTerminal
List files, including hidden onesls -laGet-ChildItem -ForceTerminal
Make nested foldersmkdir -p a/b/cNew-Item -ItemType Directory -Force a/b/cTerminal
Delete a folder, after checking the pathpwd, ls folder, then rm -r folderRemove-Item -Recurse folder -WhatIf firstTerminal
Keep the lines that matchgrep '^S-014' sales.csvSelect-String '^S-014' sales.csvTerminal
Count lines per value in column 1 of a CSVtail -n +2 f.csv | cut -d, -f1 | sort | uniq -cImport-Csv f.csv | Group-Object siteIdTerminal
Send output to a file (replace, append)> file, >> file> file, >> fileTerminal
See the last exit codeecho $?$LASTEXITCODETerminal
Set a variable for this terminalexport STORE_ID=S-014$env:STORE_ID = 'S-014'Terminal
Set a variable for one command onlySTORE_ID=S-102 node report.jsSet it, run, then set it backTerminal
See which copy of a program runswhich -a nodeGet-Command node -AllTerminal
Let a script run as a programchmod +x script.shNot neededTerminal

npm in one breath

npm init -y starts a package.json. npm install downloads what it lists into node_modules; npm ci installs exactly what the lockfile says, for CI. npm install --save-dev --save-exact prettier adds a pinned tool to the project. npm start, npm test and npm run lint run scripts by name, and npm pkg set scripts.lint="eslint ." adds one. npx prettier --check . runs the project's own copy of a tool. npm ls --depth=0 shows what is installed (How code becomes a running program, The terminal without fear, Node.js and npm).

Git: "I want to..."

Every command here was run on Git 2.43. Commands that change history are marked; use them only on commits you have not pushed, or that only you use.

I want to...CommandLesson
Start tracking a projectgit init -b mainSnapshots
Set my name and email oncegit config --global user.name "Your Name" and user.emailSnapshots
See what changed and what is stagedgit status, git diff, git diff --stagedEveryday Git
Stage only part of a filegit add -p fileEveryday Git
Commit with a good messagegit commit -m "fix(pos): round VAT in cents"Everyday Git
Read history as a graphgit log --oneline --graph --allEveryday Git
Find when a piece of text appeared or disappearedgit log -S "discountCents" --onelineCode detective
See who last changed a linegit blame -L 40,60 src/stock.tsCode detective
Start a branch and switch to itgit switch -c feat/123-short-name (older: git checkout -b)Branches
Merge a branch, always with a merge commitgit merge --no-ff feat/123-short-nameBranches
Delete a merged branchgit branch -d feat/123-short-nameBranches
Give up on a merge with conflictsgit merge --abortConflicts
Throw away my edits to a filegit restore fileUndo
Unstage a file but keep the editsgit restore --staged fileUndo
Fix the last commit (message or a forgotten file)git commit --amend (rewrites history)Rewriting history
Undo the last commit, keep the changes stagedgit reset --soft HEAD~1 (rewrites history)Undo
Undo a commit that is already pushedgit revert <sha> (adds a new commit)Undo
Get back a deleted branch or a bad resetgit reflog, then git branch name <sha>Undo
Park unfinished work, then bring it backgit stash push -u -m "wip", git stash popRewriting history
Clean up my branch's commits before a PRgit rebase -i main (rewrites history)Rewriting history
Fold a fix into an earlier commitgit commit --fixup <sha>, then git rebase -i --autosquash mainRewriting history
Copy one fix onto a release branchgit cherry-pick <sha>Rewriting history, Branches and releases
Get teammates' work without merging it yetgit fetch, then compare with origin/mainRemotes
Update my branch from the remote, linear historygit pull --rebaseRemotes
Push a new branch and track itgit push -u origin feat/123-short-nameRemotes
Push after a rebase, safelygit push --force-with-lease (never plain --force on shared branches)Rewriting history
Mark a releasegit tag -a v1.4.0 -m "v1.4.0", git push origin v1.4.0Branches and releases
Find the commit that broke somethinggit bisect start BAD GOOD, then git bisect run npm testCode detective
Preview deleting untracked filesgit clean -n (then -f to do it)Undo
Look inside an objectgit cat-file -p HEADInside .git

GitHub CLI in one breath

gh auth login once, then: gh repo create, gh issue create, gh pr create --fill, gh pr checks --watch, gh pr review --approve, gh pr merge --squash --delete-branch, gh run watch, gh release create v1.4.0 --generate-notes, and gh api for anything else (GitHub: remotes, clone, push, pull and authentication, Pull requests and code review, Project: ship a small app end to end).

VS Code shortcuts

These are VS Code's default bindings, checked against its default keybinding lists for each platform. Linux uses the Windows keys except where noted. A comma means "press the first combination, release, then the second". If a shortcut does nothing, run Preferences: Open Keyboard Shortcuts to see what your setup uses (VS Code essentials).

ActionWindows / LinuxmacOS
Command PaletteCtrl+Shift+P or F1Cmd+Shift+P or F1
Quick Open a file by nameCtrl+PCmd+P
SettingsCtrl+,Cmd+,
Toggle the terminalCtrl+`Ctrl+`
New terminalCtrl+Shift+`Ctrl+Shift+`
Show or hide the side barCtrl+BCmd+B
ExplorerCtrl+Shift+ECmd+Shift+E
Search across filesCtrl+Shift+FCmd+Shift+F
Source ControlCtrl+Shift+GCtrl+Shift+G
Run and Debug viewCtrl+Shift+DCmd+Shift+D
ExtensionsCtrl+Shift+XCmd+Shift+X
Problems panelCtrl+Shift+MCmd+Shift+M
Toggle line commentCtrl+/Cmd+/
Select next match (multi-cursor)Ctrl+DCmd+D
Add a cursor belowCtrl+Alt+Down (Linux: Shift+Alt+Down)Cmd+Option+Down
Move line downAlt+DownOption+Down
Copy line downShift+Alt+Down (Linux: Ctrl+Shift+Alt+Down)Shift+Option+Down
Delete lineCtrl+Shift+KCmd+Shift+K
Go to DefinitionF12F12
Find All ReferencesShift+F12Shift+F12
Rename SymbolF2F2
Format DocumentShift+Alt+F (Linux: Ctrl+Shift+I)Shift+Option+F
Quick Fix (light bulb)Ctrl+.Cmd+.
Go to lineCtrl+GCtrl+G
Go to symbol in file (Outline)Ctrl+Shift+OCmd+Shift+O
Go back after jumpingAlt+Left (Linux: Ctrl+Alt+-)Ctrl+-
Split editorCtrl+\Cmd+\
Markdown preview to the sideCtrl+K, VCmd+K, V
Zen mode (Esc twice to leave)Ctrl+K, ZCmd+K, Z
Start debugging / toggle breakpointF5 / F9F5 / F9
Keyboard Shortcuts editorCtrl+K, Ctrl+SCmd+K, Cmd+S

JavaScript gotchas

Each result below is real output from Node 24. Most of these catch every team at least once.

You writeYou getDo this insteadLesson
0.1 + 0.20.30000000000000004Keep money as integer cents; format with Intl.NumberFormatData and money
1999 * 0.15 (a 15% discount)299.84999999999997Math.round(1999 * 15 / 100) gives 300Data and money
[10, 9, 1].sort()[1, 10, 9] (sorted as text).sort((a, b) => a - b), or toSorted to avoid changing the arrayData and money
'5' + 1 and '5' - 1"51" and 4Convert input first: Number(value)JS basics
0 == ''trueAlways ===JS basics
typeof null"object"Check value === null directlyJS basics
NaN === NaNfalseNumber.isNaN(x)JS basics
qty || 5 when qty is 05 (zero is falsy)qty ?? 5 only replaces null and undefinedJS basics
const b = a; b.qty = 9a.qty is now 9 tooCopy: { ...a }, or structuredClone(a) for nested dataReferences
{ ...order }, then change copy.lines[0]The original order changesSpread is shallow; copy nested parts too, or use structuredCloneReferences
{ qty: 1 } === { qty: 1 }false (two objects)Compare fields, or IDsReferences
Object.freeze(o), then o.n.q = 2Works; freeze is shallowTreat state as immutable by habit; freeze is not deepReferences
new Date('2026-10-07').getDate()7 in Lagos or Singapore, 6 in New YorkDate-only strings are UTC; store ISO timestamps, format with a time zoneData and money
JSON.stringify({ d: new Date(0), u: undefined }){"d":"1970-01-01T00:00:00.000Z"}Dates become strings, undefined disappears; parse dates back yourselfData and money
['1', '2', '3'].map(parseInt)[1, NaN, NaN].map(Number) or .map((s) => parseInt(s, 10))Closures
items.forEach(async (i) => { await save(i) })Code after it runs before any save finishesfor (const i of items) await save(i), or await Promise.all(items.map(save))Async JS
for (var i ...) setTimeout(() => log(i))3 3 3Use let: each loop turn gets its own i (prints 0 1 2)Closures
Number.MAX_SAFE_INTEGER + 29007199254740992 (wrong by 1)Use BigInt or strings for very large IDsData and money
sales.groupBy(...)TypeError: sales.groupBy is not a functionObject.groupBy(sales, fn); check AI suggestions against the docsData and money, AI assistants

Glossary

Plain definitions of the terms used most on the Developer track, each with the lesson that explains it.

AGENTS.md
A Markdown file in a repo that tells AI coding assistants how the project works: commands, layout and rules. Working with AI coding assistants
Branch
A movable name that points at a commit and moves forward as you commit; cheap to create and delete. Branches and merging
Bundle
The file or files a bundler produces from your source and its imports, ready to send to a browser or app. Performance and memory in JavaScript
CI (continuous integration)
Automatically building and testing every change, usually on each push and pull request. GitHub Actions: continuous integration
CD (continuous delivery or deployment)
Automatically releasing tested changes to an environment, with or without a final approval. Deploying and securing with GitHub Actions
Change fail rate
The share of deployments that need an immediate fix, such as a hotfix or a rollback. One of DORA's four keys. Your team's engineering playbook
Closure
A function together with the variables it captured from where it was created, which stay alive as long as the function does. Functions, scope and closures
CODEOWNERS
A file that maps paths to the people or teams who must be asked to review changes there; the last matching line wins. Pull requests and code review
Commit
A saved snapshot of the project plus author, date, message and a pointer to its parent commit. What Git really is: snapshots and the three areas
Conventional Commits
A message format such as feat(api): add stock endpoint that tools can read to build changelogs and pick version numbers. Everyday Git: status, diff, log and good commits
CORS
Cross-origin resource sharing: the browser rule that a page may call another origin's API only if that API's response headers allow it. JavaScript in the browser
Detached HEAD
When HEAD points straight at a commit instead of a branch; new commits there are easy to lose unless you create a branch. Inside the .git folder: objects, refs and HEAD
DOM
Document Object Model: the browser's tree of objects for a page, which JavaScript reads and changes. JavaScript in the browser
DORA metrics
Deployment frequency, change lead time, change fail rate and recovery time: measures of how fast and how safely a team delivers. Your team's engineering playbook
Environment (GitHub)
A named deployment target such as staging or production, with its own secrets and protection rules like required approvals. Deploying and securing with GitHub Actions
Environment variable
A named text value, such as PATH or STORE_ID, that each program inherits from the one that started it; Node reads them through process.env. The terminal without fear
ES modules
The standard JavaScript module system using import and export; Node uses it when "type": "module" is set. Prototypes, classes and modules
Event loop
The mechanism that lets single-threaded JavaScript run queued callbacks one at a time, microtasks first, so it never waits idle on I/O. The event loop
Exit code
The number a program returns when it ends: 0 for success, anything else for failure. CI steps, hooks and && all decide from it. The terminal without fear
Fast-forward merge
A merge where the branch pointer simply moves ahead because no new commits exist on the target; no merge commit is created. Branches and merging
Fetch vs pull
Fetch downloads new commits and updates origin/main; pull is fetch plus merge or rebase into your branch. GitHub: remotes, clone, push, pull and authentication
Flat config
ESLint's configuration format: an eslint.config.js that exports an array of config objects applied in order. ESLint 10 reads no other format. VS Code for teams: formatting, linting and shared settings
Formatter
A tool such as Prettier that rewrites code layout into one consistent style without changing what the code does. VS Code for teams: formatting, linting and shared settings
Garbage collection
The engine freeing memory for objects that can no longer be reached from any root. Performance and memory in JavaScript
GitHub Actions
GitHub's automation system: YAML workflows that run jobs on hosted runners when events such as a push or PR happen. GitHub Actions: continuous integration
HEAD
Git's pointer to what you have checked out, usually a branch name. Inside the .git folder: objects, refs and HEAD
Heap snapshot
A file listing every live object in a JavaScript process and what holds it, used to find memory leaks. Performance and memory in JavaScript
Hidden class
V8's internal record of an object's layout; objects built with the same fields in the same order share one and are faster to read. Performance and memory in JavaScript
Hotfix
A small, urgent fix released outside the normal schedule, through the same checks, usually as a patch version. Branching strategies, releases and versions, Project: ship a small app end to end
Index (staging area)
The list of changes that will go into the next commit; git add puts changes there. What Git really is: snapshots and the three areas
JIT compiler
The part of the engine that turns frequently run JavaScript into fast machine code while the program runs. Performance and memory in JavaScript
Lead time for changes
How long a change takes from first commit to running in production. Your team's engineering playbook
Linter
A tool such as ESLint that reads code and flags likely bugs and rule breaks without running it. VS Code for teams: formatting, linting and shared settings
Lockfile
package-lock.json: the exact version and hash of every installed package, so every machine installs the same tree. Node.js and npm
LRU cache
A cache with a size limit that removes the least recently used entry when full. Performance and memory in JavaScript
Memory leak
Memory that stays in use because something still references objects the program no longer needs. Performance and memory in JavaScript
Merge conflict
When two branches changed the same lines and Git needs a person to decide the result. Merge conflicts without panic
Microtask
A high-priority callback, such as a promise reaction, that runs before the event loop picks the next task. The event loop
npm ci
Installs exactly what the lockfile says, from scratch, and fails if package.json and the lockfile disagree; use it in CI. Node.js and npm
OIDC (in Actions)
A way for a workflow to get a short-lived cloud credential by proving who it is, so no long-lived secret is stored. Deploying and securing with GitHub Actions
PATH
The list of folders the shell searches, in order, when you type a program's name; the first match runs. The terminal without fear
Pre-commit hook
A script Git runs just before creating a commit; if it exits non-zero, there is no commit. husky installs it and lint-staged keeps it fast. VS Code for teams: formatting, linting and shared settings
Promise
An object for a value that arrives later; it is pending, then fulfilled or rejected, and await waits for it. Async JavaScript: callbacks, promises and async/await
Prototype chain
The chain of objects JavaScript searches when a property is not found on the object itself. Prototypes, classes and modules
Prototype pollution
An attack where input such as a __proto__ key makes code write onto Object.prototype, changing every object. Security and quality in JavaScript projects
Provenance
A signed record linking a published package to the source commit and CI workflow that built it. Security and quality in JavaScript projects
Pull request (PR)
A request to merge one branch into another, with the diff, CI checks, review and discussion in one place. Pull requests and code review
Rebase
Replaying your commits on top of another commit to make history linear; it rewrites those commits. Rewriting history safely: rebase, squash, cherry-pick, stash
Reflog
Git's local diary of where HEAD and branches pointed, used to recover lost commits. Undo anything: restore, reset, revert and reflog
Remote
A named link to another copy of the repository, usually origin on GitHub. GitHub: remotes, clone, push, pull and authentication
Reset vs revert
Reset moves a branch pointer back (rewrites history); revert adds a new commit that undoes an old one (safe after pushing). Undo anything: restore, reset, revert and reflog
Ruleset
A set of GitHub rules on branches or tags, such as required reviews, required checks and no force pushes. Branching strategies, releases and versions
Runner
The machine that runs a GitHub Actions job; GitHub-hosted runners are fresh virtual machines for each job. GitHub Actions: continuous integration
Runtime
A JavaScript engine plus the abilities a program can call: the page and fetch in a browser, files, the network and environment variables in Node.js. How code becomes a running program
Semantic versioning
MAJOR.MINOR.PATCH: breaking change, new feature, bug fix. ^1.4.0 allows any 1.x from 1.4.0 up. Node.js and npm
Shallow copy
A copy of an object's top level only; nested objects are still shared with the original. Objects, arrays and references
Squash merge
Merging a PR as a single new commit on the target branch, combining all its commits. Pull requests and code review
Supply-chain attack
An attack that reaches you through a dependency or tool you trust, such as a hijacked npm package. Security and quality in JavaScript projects
Tag
A fixed name for one commit, used to mark releases such as v1.4.0. Branching strategies, releases and versions
Trunk-based development
Everyone merges small changes into main at least daily, keeping it releasable, often behind feature flags. Branching strategies, releases and versions
Type narrowing
TypeScript working out a more specific type after a check, such as if (r.ok) on a union. TypeScript for a JavaScript team
Workflow
A YAML file in .github/workflows/ that says when to run and which jobs and steps to run. GitHub Actions: continuous integration
Workspace settings
VS Code settings in a project's .vscode/settings.json; they override each person's user settings for that project. VS Code essentials
XSS (cross-site scripting)
Getting attacker-controlled script to run in your page, usually because user text was inserted as HTML. Security and quality in JavaScript projects