GitHub
gitgithubGuideBeginner
GitHub CLI (gh) Command Reference
Mastering the official GitHub command line tool: gh auth, gh repo clone, gh pr create, gh issue list, and gh workflow run.
Verified: 2026-09-30
Platforms:
all
#github#gh#cli#terminal#automation
GitHub CLI (gh) Command Reference
The GitHub CLI (gh) brings pull requests, issues, GitHub Actions, and repository management directly into your terminal.
1. Installation & Authentication
# Install via Homebrew (macOS/Linux):
brew install gh
# Authenticate your terminal with GitHub:
gh auth login2. Essential gh Commands Cheat Sheet
Managing Pull Requests
# 1. Create a pull request interactively from current branch:
gh pr create --web
# 2. View active pull requests:
gh pr list
# 3. Check out a colleague's PR locally:
gh pr checkout 42
# 4. Review, approve, and comment on a PR from terminal:
gh pr review 42 --approve -b "LGTM!"
# 5. Merge PR automatically when CI passes:
gh pr merge 42 --squash --delete-branchManaging Issues
# Create a new issue:
gh issue create --title "Fix broken CORS header" --body "Details..."
# List open issues:
gh issue listManaging GitHub Actions Workflows
# View recent workflow execution status:
gh run list
# View live log output of a running CI job:
gh run watchRelated Topics
GitHub Branch Protection Rules
Protecting production branches: requiring pull request reviews, requiring status checks (CI), preventing force pushes, and repository governance.
GitHub Releases & Binary Distribution
Publishing project releases on GitHub: linking Git tags, generating automated release notes, attaching binary assets, and pre-releases.