How to use GitHub CLI

If you love to work on open-source or collaborating projects, you must have used GitHub for hosting your code on a remote computer and collaborating with other developers across the world.

But using a Git locally and exiting the terminal each time to check the status on the GitHub web app is cumbersome. Therefore, GitHub has announced a new command-line tool “GitHub CLI” to interact with GitHub directly from the local terminal.

What does the new Github CLI offer?

GitHub brings a command-line application to execute the web GitHub events related to issues and pull requests from your local terminal.

You can use ‘gh’ command-line tool to interact with your hosted projects on GitHub and perform various actions.

GitHub CLI help
GitHub CLI help

Here’s are some highlighted functions that you can perform directly from your terminal:

  • Quick status checks of the pull request and issues
  • Filter lists of issues with labels
  • Create a pull request
  • View status of your pull request
  • Checkout to pull requests branch

For more command details, you can check out the official manual.

How to install GitHub CLI?

GitHub CLI beta version is available for macOS, Windows, and Linux.

To install the GitHub CLI, run the command:

on macOS

brew install github/gh/gh

on Windows

scoop bucket add github-gh https://github.com/cli/scoop-gh.git
scoop install gh

You can follow the installation command for various Linux distros from here.