>_ ghcli.com
Unofficial GitHub CLI reference

Every gh command,
with the example you need

A fast, no-nonsense reference for the GitHub CLI. Real commands, every flag, and fixes for the errors you'll actually hit — all copy-paste ready.

22commands
6categories
MITopen source
zsh — ghcli
$ gh pr create --fill --reviewer alice
Creating pull request for feature/rate-limit into main
✓ https://github.com/acme/api/pull/128
$ gh pr checks 128 --watch
◯ build   ◯ test   ✓ lint
$ gh pr merge 128 --squash --delete-branch
✓ Merged. Deleted branch feature/rate-limit
$

01 — The reference

22 commands, 6 things you actually do

22 commands
gh pr create

Open a pull request from the command line.

gh pr checkout

Switch to any PR branch, including forks.

gh pr list

List and filter pull requests.

gh pr merge

Merge a PR, your way.

gh pr checks

See CI status without the browser.

gh pr view

Read a PR without leaving your shell.

gh repo clone

Clone with shorthand, no full URL.

gh repo create

Create a repo from your shell.

gh repo fork

Fork and set up remotes in one step.

gh repo view

Read a repo's README and stats in-terminal.

gh issue create

File an issue without the browser.

gh issue list

Triage issues from the command line.

gh issue close

Close issues, with a reason.

gh release create

Tag, note, and ship a release.

gh gist create

Share a snippet in seconds.

gh api

Authenticated API calls, no token juggling.

gh workflow run

Kick off an Actions workflow on demand.

gh run watch

Follow an Actions run in real time.

gh auth status

Confirm who you're signed in as.

gh auth token

Get the token for scripts and other tools.

gh alias set

Turn long commands into shortcuts.

gh extension install

Add new gh commands from the community.

02 — First things first

gh vs git — what's the difference?

The single most common point of confusion for people new to the GitHub CLI.

git your machine

Manages your local repository: commits, branches, merges, history. It only talks to GitHub for push, pull, and fetch.

  • git commit / branch / rebase
  • git push & git pull
  • Knows nothing about pull requests or issues

gh the GitHub layer

Manages everything GitHub adds on top: pull requests, issues, releases, Actions, and the API — all from the same terminal.

  • gh pr / issue / release
  • gh run & gh workflow for Actions
  • gh api for anything else

Short version: git moves code, gh moves GitHub. They're complements, not competitors — you use both.

03 — Setup

Install gh in one line

The GitHub CLI runs on macOS, Windows, and Linux. Install it, sign in once, and every command on this site just works.

macOS

Homebrew

brew install gh
Windows

WinGet

winget install --id GitHub.cli
Linux

Debian / Ubuntu

sudo apt install gh

Then sign in once and you're ready:

gh auth login

The whole reference, on one page

Download the ghcli cheat sheet — every core command with its most useful example, ready to pin next to your terminal.

04 — FAQ

GitHub CLI, answered

What is the GitHub CLI (gh)?

The GitHub CLI, invoked as gh, is GitHub's official command-line tool. It brings pull requests, issues, releases, GitHub Actions, and the full API into your terminal, so you can work with GitHub without switching to a browser.

Is the GitHub CLI free?

Yes. gh is free and open source, available for macOS, Windows, and Linux. It works with free GitHub accounts as well as Team, Enterprise Cloud, and Enterprise Server.

What is the difference between gh and git?

git manages your local repository — commits, branches, and history. gh manages GitHub-specific things layered on top, like pull requests, issues, and Actions. You use them together.

How do I install the GitHub CLI?

Install gh with a package manager: brew install gh on macOS, winget install --id GitHub.cli on Windows, or sudo apt install gh on Debian and Ubuntu. Then run gh auth login to sign in.

Is ghcli.com the official GitHub CLI site?

No. ghcli.com is an independent, unofficial command reference. The official tool and documentation live at cli.github.com and github.com/cli/cli.