So GitHub has a CLI - let's take a look
Published Sep 23 2021 12:01 AM 6,001 Views

Did you know there is a command line interface available for GitHub interactions?  If you are working within a command line and need to interact with GitHub it means less context switching.  The GitHub CLI tool was released in September 2020 and is now on version 2.0 of the tool.


The GitHub CLI tool Is available for install on Windows, macOS and Linux operating systems.


From within the GitHub CLI tool, you can interact with a lot of GitHub functions.   You can manage gists, issues, pull requests (pr), repositories, GitHub secrets, and GitHub Actions to list a few of the core commands.


Let’s look at those commands in action.


Create and view issues

If you have cloned a GitHub repository (repo) to your local machine to work on, for example I have a copy of my GitHub profile repo on my machine. If I am working inside Windows Terminal I can check if there are any issues listed against that repo.


GitHub CLI Issue commandGitHub CLI Issue command


I can also create an issue within the terminal.


GitHub CLI Issue command in actionGitHub CLI Issue command in action


The work within the terminal can then be seen inside a browser. The flags and text that I put within the issue has been transferred across, as you would expect.


GitHub issue on the webGitHub issue on the web



You can also close the issue or edit it or even delete the issue, depending on the best way to manage that issue.


Track a Pull Request

You don’t have to always have the GitHub repo cloned to your local computer to interact with it via the CLI tool.


If you are tracking a pull request (PR) within a repository and know the URL you can use the GitHub CLI to view or interact with it.


GitHub CLI PR commandGitHub CLI PR command


Viewing the PR is something you can do, as demonstrated in the above picture but you can also look at closing, commenting, editing, merging, etc that PR into the repository.  For some people using the web graphical user interface will be much easier but for others this CLI command tool will be better suited.


GitHub Gist

I’m a big fan of using the GitHghub gist feature for a few reasons. And I’m able to view and edit them from the GitHub CLI as well.  I can list my gist’s and then edit them.


When I issue the gh gist edit <gist ID> command it will open up the gist within Notepad for me to edit and I can then save the changes and they are locked in.  Such an easy way of editing a gist or viewing it.


GitHub CLI gist commandGitHub CLI gist command


There is so many possibilities with this tool, install GitHub CLI today and leave me a comment below with what use cases it helps you with.

Version history
Last update:
‎Sep 07 2021 04:15 AM
Updated by: