Something caught my eyes when I opened up my GitHub account a few days back. In the spotlight, GitHub was flaunting the launch of version 1.0 of their CLI.
As a command-line fanatic, I knew I have to check this thing. And that’s exactly what I did, I installed it on my machine and started playing. So, here I’m writing about everything I’ve explored so far.
Installation was pretty straightforward (at least on macOS). I use Homebrew so all I had to do was:
brew install gh
After installation, I ran some generic commands:
gh --version # Checking the CLI version gh --help # See the available commands
The CLI offers a very interactive command to connect with your GitHub account:
gh auth login
Some questions will be asked, and (don’t worry) there will be options you’ll need to select (using the arrows and hitting
54F4-9F4E). Copy that code and hit
Enterto open the web browser for authentication.
Congratulations, you're all set!, close the browser tab, and return back to the terminal.
Authentication complete. Press Enter to continue…. Hit
Logged in as your-github-usernameand the interactive session will end.
Let’s start by building our playground.
gh repo create gh-cli-experiments
Few questions will be asked, some confirmations will be taken, and the result will look like this: https://github.com/abhishek-pokhriyal/gh-cli-experiments.
Now that we have a brand new repository, let’s create some issues.
gh issue create -R abhishek-pokhriyal/gh-cli-experiments
-R option is to specify the repository on which I’m opening the issue.
There are a lot of options available when you create an issue. You don’t need to remember that, just run
gh issue create --help
I saw some of the options and then ran this command:
gh issue create --title "Add License" --assignee abhishek-pokhriyal -R abhishek-pokhriyal/gh-cli-experiments
and I got this: https://github.com/abhishek-pokhriyal/gh-cli-experiments/issues/2.
Want to keep a track on the list of issues? Run:
gh issue list -R abhishek-pokhriyal/gh-cli-experiments
and get this pretty list outputted on your terminal.
gh --help reveals quite a few commands classified as
Additional ones. The core ones (as of now) are
This means you can manage gists, issues, pull requests, releases, and repositories straight from the command-line. That’s a lot for
So that was all, my very first experience playing with the GitHub CLI. If you’re excited and would like to dig deeper, you can check out the official manual. Also, if you’re interested in the development of the CLI, would like to report a bug, or have a feature request, you can do so in their open-source GitHub repository.
One of the advantages of CLI tools is that they can significantly help in improving the processes by automating chores. The possibilities are endless, so if you’ve any thoughts or suggestions for bringing the GitHub CLI into the software development processes, please do share those in the comments.
The possibilities are endless. Keep experimenting!