Master the GitHub CLI (gh) for creating PRs, managing issues, checking Actions status, and cloning repos — all without leaving the terminal.
The GitHub CLI (gh) brings pull requests, issues, Actions, and repos to your terminal — no browser needed for routine GitHub tasks.
By the end of this 12 min guide, you'll have a working GitHub CLI setup and practical GitHub CLI workflows you can use immediately.
Install GitHub CLI:
brew install ghgh --version or gh -V after installing.Run gh auth login to authenticate. Then use gh pr, gh issue, gh repo, and gh run subcommands for everything GitHub.
Here's a foundational configuration to start with:
# Create PR from CLI
gh pr create --title "Fix: login bug" --body "Resolves #123"
gh pr checkout 42 # checkout PR #42 locally
gh issue list --assignee @meWith GitHub CLI configured, these GitHub CLI-specific workflows will save you time every day:
gh pr create open a PR from current branchgh pr checkout 42 check out a PR locallygh issue list --assignee @me your issuesgh run watch watch Actions in terminalgh repo clone owner/repo clone with one commandOnce you're comfortable with GitHub CLI basics, these advanced techniques will transform your GitHub CLI workflow:
gh alias set co "pr checkout"gh api for direct API callsHere are the most common GitHub CLI issues and how to fix them:
gh auth status to check--jq to limit API callsgh extension installCongratulations — you now have a solid GitHub CLI foundation. Here's where to go next: