Use GitHub CLI without leaving the terminal
Use GitHub CLI without leaving the terminal
Once Git commands feel natural, switching to a browser for every GitHub action can interrupt flow. GitHub CLI exposes many platform operations as gh commands.
What you’ll learn
- Distinguish git from gh.
- Inspect issues and PRs from the terminal.
- Use GitHub CLI as a productivity tool.
Two CLIs, two layers
git
Manage local/distributed repository history.
commit / branch / fetchgh
Manage GitHub platform objects.
PR / issue / releaseTogether
Use repository context to move smoothly between code and collaboration.
developer workflow
git and gh are different command-line tools
git operates on Git repositories, commits, branches and remotes. gh communicates with GitHub for repository, issue, pull request, release and other platform operations.
Typical commands include gh auth login, gh repo view, gh issue list, gh pr status and gh pr create. Use gh help and subcommand help instead of memorizing everything.
Inspect GitHub state from the project directory
Run this in a disposable practice repository unless the lesson explicitly says otherwise.
gh auth status
gh repo view
gh issue list
gh pr status
gh pr view --webgh can often infer the current GitHub repository from your configured Git remote. Authentication and permissions still determine which operations are allowed.
Practice: GitHub CLI
Your task: Create a disposable issue with gh issue create, list it, then open it in the browser with the appropriate gh command.
Common pitfall to avoid
CLI convenience does not remove the need to inspect what an action will change. Read command help, especially for destructive or organization-wide operations.
Check your understanding
GitHub CLI: what to remember
Use GitHub CLI without leaving the terminal is complete when you can explain the state being changed before you run the command, not merely repeat the syntax.
Read further: official supporting documentation.
Reaching the recap and completing the quizzes are separate milestones.