What Is GitHub CLI?
GitHub CLI (gh) is GitHub's official command-line tool. It brings pull requests, issues, GitHub Actions, and other GitHub features directly into your terminal so you can work entirely from the command line.
gh works seamlessly with GitHub from the command line.
Why Use It?
- Stay in the terminal — no context-switching to the browser for routine tasks
- Use your own editor — write issue bodies and PR descriptions in Vim, VS Code, or any editor you like instead of GitHub's tiny text area
- Script and automate — every command is designed to be composable in shell scripts and CI pipelines
- Faster workflows — create a PR, merge it, and clean up branches in seconds
A Brief History
Hub (2009–present)
In late 2009, GitHub co-founder Chris Wanstrath created a tool called Hub — a CLI wrapper around Git that added GitHub functionality. Over the next decade it accumulated 20,000+ stars and 200+ contributors.
Hub is not an official GitHub product. It is a community-maintained open source project that happens to have been started by a GitHub employee.
GitHub CLI (2019–present)
In October 2019, GitHub announced an official CLI. Rather than building on top of Hub, they started fresh for several reasons:
- They wanted to take a different architectural direction
- They didn't want to break Hub's existing user base
- They wanted tight, first-party integration with GitHub's API
The project reached 1.0 stable in late 2020 and has been on a rapid release cadence (roughly every two weeks) ever since. It already has 30,000+ stars and hundreds of contributors.
You can use both tools. Hub continues to be maintained, and the official CLI does not aim for feature parity with Hub.
What You Can Do with gh
| Category | Examples |
|---|---|
| Repositories | Clone, create, fork, view, edit, sync, archive |
| Issues | Create, list, view, close, comment, assign, label |
| Pull Requests | Create, review, merge, checkout, diff, revert |
| GitHub Actions | List runs, watch live logs, rerun failed jobs, manage caches |
| Releases | Create releases, upload assets, download binaries |
| Projects | Create boards, manage items, configure fields |
| Codespaces | Create, SSH into, forward ports, copy files |
| Search | Search repos, code, issues, PRs, and commits across all of GitHub |
| API | Make arbitrary REST or GraphQL requests with built-in auth |
| Extensions | Install community-built commands or create your own |
Course Overview
This course takes you from zero to productive with gh. Each chapter is self-contained with explanations, command references, and hands-on exercises.