What is GitHub CLI?
Bring GitHub to your beloved terminal.
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 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 using a web browser and reducing context switching in our workflow.
- A popular way to install Git CLI is using Git-scm.
- For GitHub CLI, you can install it from https://cli.github.com/.
What can GitHub CLI do? 🍀
With many production-ready features (and more to come), you can use GitHub CLI 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
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).
- 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.
- 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.)
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 an excellent solution for you.
If you want to learn more about GitHub, you might want to look at my following articles:
- GitHub Actions basics - Event, Workflow, Runner, Job, and Action
- Advanced GitHub Actions - Conditional Workflow
For more information about GitHub CLI, you can take a look at GitHub CLI's official documentation.