← All bricks

gh · Beginner

gh: GitHub from the Command Line

Get fluent with the gh CLI — sign in, work with repositories, issues and pull requests, watch CI runs, cut releases, query the API, and make the tool your own, one small command at a time.

Most people drive GitHub through the website, clicking between tabs while their work lives in the terminal. gh closes that gap: pull requests, issues, releases, Actions and the raw API are all one short command away, right next to your code. This course follows a single small project — a shop called widget-store — and builds real fluency one command at a time. We sign in, look at a repository, triage and file issues, open and review pull requests, watch a CI run finish, cut a release, and reach the API directly when no command exists yet. Reading gh's output is half the skill, so every transcript is the real thing — the issue numbers, the PR state, the run status — and we learn to pull exactly the field we want out of it. By the end gh is yours: an alias or two, a default, and the everyday GitHub loop without leaving the keyboard.

What you'll build

  • Authenticate gh and confirm which account is active
  • Inspect, clone and create repositories
  • Triage, file, comment on and close issues
  • Open, list, review and merge pull requests
  • Watch GitHub Actions runs and cut a release
  • Query the GitHub API directly and extract fields with --jq
  • Customise gh with aliases and config

Contents

  1. Check the tool
  2. See who you are
  3. Sign in
  4. Look at a repository
  5. Ask for just the facts
  6. Clone it
  7. Create a new repository
  8. List the open issues
  9. Narrow the list
  10. File a new issue
  11. Read an issue
  12. Add a comment
  13. Close an issue
  14. Open a pull request
  15. List the pull requests
  16. Where do you stand
  17. Read a pull request
  18. See what changed
  19. Try it locally
  20. Leave a review
  21. Merge it
  22. List CI runs
  23. Inspect a run
  24. Watch it finish
  25. Cut a release
  26. List releases
  27. Reach the API directly
  28. Pull out one field
  29. Share a snippet
  30. Search across GitHub
  31. Make it your own
  32. The everyday loop