DEV Community

Cover image for 🌱 GitHub CLI in 3 minutes
Hung Vu
Hung Vu

Posted on • Originally published at hungvu.tech

🌱 GitHub CLI in 3 minutes

Probably you have been familiar with Git CLI, but have you ever heard of GitHub CLI?

What is GitHub CLI? How is it different from Git CLI? πŸ€

GitHub is a popular closed-source for-profit software development platform built on top of Git, a monetary-free and distributed version control system. GitHub is not limited to version control capability, it also includes CI/CD, project management tools and several other services.

Software engineer uses Git CLI for commands such as git clone, git merge to interact with a version control system locally. The local changes can then be pushed and hosted on GitHub. Meanwhile, GitHub CLI allows us to directly control the whole GitHub repository and other GitHub services from the command line, avoiding the use of a web browser and reducing context switching in our workflow.

A popular way to install Git CLI is using Git-scm.
Git-scm icon.png

For GitHub CLI, you can install it from https://cli.github.com/.
GitHub CLI icon.png

What can GitHub CLI do? πŸ€

With many production-ready features (and more to come), you can use GitHub CLI in combination with other tools (e.g., GitHub Actions) or scripting languages to create highly customized automated jobs. This greatly improves productivity and changes our traditional web GUI workflow (not to be confused with GitHub Actions workflow). Each command supports several different tasks and options. For example, in gh auth, we have login and logout.

As of April 2022, there are 3 groups of commands in GitHub CLI.

  • The core commands
gh auth // Authenticate GitHub CLI and Git with GitHub.
gh browse // Open your chosen GitHub repository in the web browser.    
gh codespace // Manage your codespaces.       
gh gist // Manage GitHub gits.
gh issue // Manage GitHub issues.
gh pr // Manage GitHub pull requests.
gh release // Manage application releases.
gh repo // Manage repository-level tasks (e.g. deletion, cloning).
Enter fullscreen mode Exit fullscreen mode
  • The GitHub Actions commands
gh run // List, view, and watch recent workflow runs from GitHub Actions.
gh workflow // List, view, and run workflows in GitHub Actions.
Enter fullscreen mode Exit fullscreen mode
  • The additional commands
gh alias // Set command shortcuts.
gh api // Send an authenticated HTTP request to GitHub API and show the response.
gh completion // Generate shell completion scripts for GitHub CLI commands.
gh config // Manage GitHub CLI configuration settings.
gh extension // Manage GitHub CLI community-maintained extensions.
gh gpg-key // Manage GPG keys registered with your GitHub account.
gh label // Manage GitHub labels.
gh search // Search across all GitHub.
gh secret // Manage GitHub secrets in repositories or organizations.
gh ssh-key // Manage SSH keys registered with your GitHub account.
gh status // Shows your GitHub activities (issues, mentions, etc.)
Enter fullscreen mode Exit fullscreen mode

Wrap up πŸ€

Although GitHub CLI has just been released for a little more than 2 years, it now has core functionalities that usual GitHub users would use. If you love to live in a terminal space, it seems GitHub CLI would be a great solution for you.

If you want to learn more about GitHub, you might want to look at my following articles:

For more information about GitHub CLI, you can take a look at GitHub CLI's official documentation.

Top comments (0)