GitHub CLI
The official command-line tool for GitHub that brings pull requests, issues, and other GitHub features to your terminal.
Also known as: gh, gh CLI
Category: Software Development
Tags: software-engineering, tools, version-control, devops, automation
Explanation
GitHub CLI (gh) is an official open-source command-line tool that brings GitHub's functionality directly to your terminal. Released in 2020, it enables developers to work with repositories, issues, pull requests, and more without leaving the command line.
**Core Features**
GitHub CLI provides native access to GitHub's most important workflows:
- **Pull Requests**: Create, view, review, and merge PRs with commands like `gh pr create`, `gh pr view`, and `gh pr merge`
- **Issues**: Manage issues through `gh issue create`, `gh issue list`, and `gh issue close`
- **Repositories**: Clone, fork, and create repos using `gh repo clone`, `gh repo fork`, and `gh repo create`
- **GitHub Actions**: View workflow runs, watch logs, and trigger workflows with `gh run list`, `gh run view`, and `gh workflow run`
- **Releases**: Create and manage releases via `gh release create` and `gh release list`
**Key Commands**
```bash
gh auth login # Authenticate with GitHub
gh repo clone owner/repo # Clone a repository
gh pr create # Create a pull request
gh pr checkout 123 # Check out a PR locally
gh issue create # Create an issue
gh api /user # Make authenticated API calls
gh codespace create # Create a GitHub Codespace
```
**Advanced Capabilities**
The `gh api` command enables direct access to GitHub's REST and GraphQL APIs with automatic authentication, making it invaluable for scripting and automation. GitHub CLI also supports aliases for custom commands and extensions for community-built functionality.
**Integration Benefits**
GitHub CLI streamlines developer workflows by eliminating context switching between terminal and browser. It integrates seamlessly with Git, allowing developers to manage both local version control and remote GitHub operations from a single interface. The tool is particularly powerful for code review, CI/CD management, and automating GitHub workflows in scripts.
Related Concepts
← Back to all concepts