We use cookies for site analytics. Accept to help us understand how the site is used. See our Privacy Policy for details.
The gh commands that remove the browser round-trip: PR create/review/merge, issues, run watching and log digging on Actions, releases, and gh api for anything without a command.
This one is less about interviews and more about the working day, though "how do you review a PR" and "how do you debug a failing CI run" are both real screening questions and both have much better CLI answers than clicking. gh is worth learning for one specific reason: it collapses the context switch. Opening a PR, checking out a colleague's branch, watching a workflow and reading the failed step's log are all things you can do without leaving the terminal you are already in. And gh api is a full authenticated REST/GraphQL client, so anything the purpose-built commands do not cover is still one command away.
| Command | What it does | Common flags | Example |
|---|---|---|---|
| gh auth login | Interactive auth (browser or token). Also configures git to use gh as a credential helper. | --web, --with-token < token.txt, --hostname github.example.com (Enterprise), --scopes | gh auth login --web |
| gh auth status | Which account, which host, which scopes. | --show-token | gh auth status |
| gh repo clone / create / fork | Repository lifecycle without the web UI. | create --public|--private --source=. --push, fork --clone --remote, clone <owner>/<repo> | gh repo create my-app --private --source=. --push |
| gh repo view | README and metadata in the terminal. | --web (open in browser), --json name,description -q .name | gh repo view --web |
| gh browse | Open the current repo, file or line in the browser. gh browse src/app.ts:42 opens that exact line. | -b <branch>, -c (commit), -s (settings), -n (print URL only) | gh browse src/lib/auth.ts:88 |
| Command | What it does | Common flags | Example |
|---|---|---|---|
| gh pr create | Open a PR from the current branch. | --fill (title/body from commits), --title --body --body-file, --base, --draft, --reviewer, --assignee, --label, --web | gh pr create --fill --base main --reviewer alice --label backend |
| gh pr list | Open PRs, filterable. | --state open|closed|merged|all, --author @me, --assignee, --label, --search, --json number,title -q '.[].title' | gh pr list --author @me --state open |
| gh pr checkout | Check out someone's PR branch locally, including from a fork. The fastest way to test a contribution. | <number|url|branch>, --detach, --force | gh pr checkout 412 |
| gh pr diff | The PR's diff in the terminal. | --name-only, --color always | less -R, --patch | gh pr diff 412 --name-only |
| gh pr review | Approve, request changes, or comment. | --approve, --request-changes, --comment, --body '...' | gh pr review 412 --approve --body 'LGTM, nice test coverage' |
| gh pr checks | Status of every check on the PR. --watch blocks until they finish. | --watch, --required, --fail-fast | gh pr checks --watch |
| gh pr merge | Merge, with the strategy as a flag. | --squash|--merge|--rebase, --auto (merge when checks pass), --delete-branch, --admin (bypass, if permitted) | gh pr merge 412 --squash --delete-branch |
| gh pr status | Dashboard view: your PRs, PRs awaiting your review, and the current branch's PR. | - | gh pr status |
| Command | What it does | Common flags | Example |
|---|---|---|---|
| gh issue create / list / view | Issue lifecycle. | create --title --body --label --assignee --project; list --state --label --search; view <n> --comments --web | gh issue create --title 'Cron 403s' --label bug --assignee @me |
| gh issue close / reopen / comment | Transition or comment on an issue. | --reason completed|'not planned', comment --body | gh issue close 88 --reason completed |
| gh run list | Recent workflow runs. | --workflow deploy.yml, --status failure, --branch main, --limit 10, --json databaseId,conclusion | gh run list --workflow ci.yml --status failure --limit 5 |
| gh run watch | Live progress of a run, exiting non-zero if it fails. Good as the last line of a push script. | <run-id>, --exit-status, --interval | gh run watch --exit-status |
| gh run view --log-failed | Print only the failed steps' logs. The single most useful gh command for CI debugging. | <run-id> --log (all), --job <id>, --web | gh run view 1234567 --log-failed |
| gh run rerun | Re-run a workflow, optionally only the failures. | --failed, --job <id>, --debug | gh run rerun 1234567 --failed |
| gh workflow run | Trigger a workflow_dispatch workflow. | <file.yml> --ref, -f key=value, --json | gh workflow run deploy.yml --ref main -f environment=prod |
| gh release create | Cut a release and upload assets. | <tag> --title --notes --generate-notes --draft --prerelease, then file paths as assets | gh release create v1.4.0 --generate-notes ./dist/app-linux ./dist/app-macos |
| Command | What it does | Common flags | Example |
|---|---|---|---|
| gh api | Authenticated REST call against any endpoint. Placeholders like {owner}/{repo} resolve from the current repo. | --method POST|PATCH|DELETE, -f key=value (string field), -F key=value (typed), --paginate, -q '.[] | .name' (built-in JQ) | gh api repos/{owner}/{repo}/pulls --paginate -q '.[] | [.number,.title] | @tsv' |
| gh api graphql | GraphQL queries for anything REST cannot express well. | -f query='...', -F owner=..., --paginate | gh api graphql -f query='{ viewer { login } }' -q .data.viewer.login |
| gh alias set | Save a command as a shortcut. Prefix with ! for a shell alias taking arguments. | <name> '<expansion>', --shell | gh alias set prs 'pr list --author @me --state open' |
| gh secret set | Write an Actions secret (repo, env or org scope). | <NAME> --body '...' | < file, --env <name>, --org, --app actions|dependabot|codespaces | gh secret set AWS_ROLE_ARN --body "$ROLE_ARN" |
| gh variable set / list | Non-secret Actions variables. | --env, --org, --body | gh variable set NODE_VERSION --body 22 |
| gh extension install | Install a community extension as a gh subcommand. | <owner>/<repo>, gh extension list/upgrade --all | gh extension install dlvhdr/gh-dash |
Time and space complexity for the data structures, sorting algorithms, and search routines that show up in coding interviews. Skim the row, remember the row, defend the row in an interview.
The recurring shapes - sliding window, two pointers, fast/slow, BFS/DFS, backtracking, DP, divide & conquer, binary search variants, union-find, topological sort. Each entry: when to reach for it, the template, complexity, and which classic problems use it.
The recurring forks in system design interviews. CAP, PACELC, sync vs async, push vs pull, SQL vs NoSQL, sharding shapes, consistency models, cache strategies, idempotency, and rate limiting. For each, the options and when to choose each.
Filesystem layout, the commands you actually use (find / grep / awk / sed / xargs), processes and signals, networking, permissions, basic shell scripting, and a vi survival kit.
Query clause order, every JOIN type and when to use it, aggregates vs window functions, what indexes actually buy you, transaction isolation levels, and the NULL / WHERE-vs-HAVING / EXISTS-vs-IN gotchas interviewers fish for.
The everyday commands, every undo scenario mapped to its fix, rebase vs merge with a side to pick, interactive rebase, bisect, the reflog safety net, stash, and the flags worth aliasing.
The docker and kubectl commands you reach for daily, Dockerfile best practices, how layer caching actually works, the core k8s objects in one screen, requests vs limits, liveness vs readiness, and a step-by-step CrashLoopBackOff debug flow.
Method semantics and idempotency, the ~15 status codes that matter, resource naming rules, offset vs cursor pagination, versioning and auth tradeoffs, error body conventions, rate-limit headers, and the smells reviewers flag.
The STAR structure with timing, what interviewers actually grade, eight question archetypes and how to frame each, the anti-patterns that sink answers (rambling, "we" instead of "I", no metrics), and a 30-second answer skeleton.
TCP vs UDP, the TLS and TCP handshakes, HTTP versions, status codes, DNS resolution, the OSI and TCP/IP layer models, and the ports you are expected to know in an interview.
Anchors, character classes, quantifiers, groups, alternation, lookarounds, backreferences, and flags - plus practical patterns and the gotchas that trip people up in interviews.
The USE method, a first-five-minutes triage runbook, and the CPU, memory, disk, network, and tracing commands you reach for when a Linux box is misbehaving.
A fast reference for concurrency primitives, synchronization tradeoffs, the memory model, and the classic bugs that show up in systems interviews and real code.
A reference for the theorems, consistency models, replication and partitioning strategies, delivery guarantees, and resilience patterns that come up in system design interviews.
Topics, partitions, and consumer groups, the three delivery semantics and how Kafka actually achieves each, ordering guarantees, rebalancing, retention vs compaction, and a straight Kafka vs SQS vs RabbitMQ vs Kinesis comparison.
Schema, types, and resolvers, the three operation kinds, the N+1 problem and DataLoader, cursor vs offset pagination, error handling that actually works, security (depth limiting, query cost), and an honest answer to 'when does REST beat GraphQL'.
State and why it must be remote and locked, the init/plan/apply lifecycle, modules and variables, count vs for_each, workspaces, import and drift, a command table, and the gotchas (prevent_destroy, secrets in state) that mark real production experience.
How LLMs work in one paragraph, the knobs (context window, temperature, top-p), system vs user prompts, few-shot and chain-of-thought, RAG and embeddings, the fine-tune-vs-prompt decision, tool calling, eval basics, and the interview questions teams actually ask now.
How B-tree indexes actually work, composite index column order, covering indexes, reading EXPLAIN ANALYZE, why the planner ignores your index, join algorithms, N+1, keyset pagination, and the 'why is this query slow' scenarios interviews are built on.
Profiles and credential resolution, the --query vs --filters distinction that trips people up, and the EC2 / S3 / IAM / VPC / Lambda / CloudWatch commands you actually reach for under time pressure.
Login and subscription juggling, the resource-group model everything hangs off, JMESPath --query, and the VM / storage / AKS / Key Vault / App Service commands worth knowing cold.
Configurations and the project/ADC model, gcloud vs gsutil vs bq, and the Compute Engine / GKE / Cloud Run / IAM / BigQuery commands that carry the ACE and Professional exams.
Chart anatomy, the values precedence order that explains every "why did my override not apply", install vs upgrade --install, template vs dry-run vs diff, and rollback.
The same operation in all three CLIs, side by side - compute, storage, networking, IAM, Kubernetes, serverless and logging - plus the service-name mapping and the model differences the equivalences hide.
Reading is the floor. The signal in interviews comes from working problems out loud and defending your tradeoffs. Spin up an AI mock interview or run a coding challenge to put these to work.