GitHub recently announced their new CLI offering. cli.github.com
It allows us to do GitHub work directly from the command line. This is more than just push
or pull
and is not tied directly to the Git command line tools. It is also not the same as GitHub’s hub CLI tool.
There are installers for Windows, Mac, and Linux. If you are on Mac, you can use Homebrew to install using:
brew install github/gh/gh
The GitHub CLI is focused on our workflows as team developers. Here’s a quick list of GitHub CLI features that we can do from the command line:
gh and hub will both continue to work. From the GitHub CLI README:
“For many years, hub was the unofficial GitHub CLI tool. gh is a new project for us to explore what an official GitHub CLI tool can look like with a fundamentally different design. While both tools bring GitHub to the terminal, hub behaves as a proxy to git and gh is a standalone tool.”
gh issue list [flags]
# flags can be:
# -a, --assignee string Filter by assignee
# -l, --label strings Filter by label
# -L, --limit int Maximum number of issues to fetch (default 30)
# -s, --state string Filter by state: {open|closed|all}
gh issue create [flags]
# flags can be:
# -b, --body string Supply a body. Will prompt for one otherwise.
# -t, --title string Supply a title. Will prompt for one otherwise.
# -w, --web Open the browser to create an issue
gh issue status [flags]
# flags can be:
# --help Show help for command
# -R, --repo OWNER/REPO Select another repository using the OWNER/REPO format
gh issue view {<number> | <url> | <branch>} [flags]
# example
# gh issue view 8
# flags can be:
# -p, --preview Display preview of issue content
gh pr checkout {<number> | <url> | <branch>} [flags]
# example
# gh pr checkout 12
gh pr create
# flags can be:
# -B, --base string The branch into which you want your code merged
# -b, --body string Supply a body. Will prompt for one otherwise.
# -d, --draft Mark pull request as a draft
# -t, --title string Supply a title. Will prompt for one otherwise.
# -w, --web Open the web browser to create a pull request
gh pr list [flags]
# flags can be:
# -a, --assignee string Filter by assignee
# -B, --base string Filter by base branch
# -l, --label strings Filter by label
# -L, --limit int Maximum number of items to fetch (default 30)
# -s, --state string Filter by state: {open|closed|merged|all} (default "open")
gh pr status [flags]
gh pr view [{<number> | <url> | <branch>}] [flags]
# example
# gh pr view 14
The GitHub CLI should help those out who work on repos with a lot of issues and PRs.
The GitHub CLI is still in early stages so give them feedback if you want to help out: https://forms.gle/umxd3h31c7aMQFKG7
#git #github #web-development