GitHub CLI (gh) Commands
The GitHub CLI, commonly known as gh
, is a powerful
command-line tool that allows developers to interact with GitHub
directly from their terminal. This tool streamlines common
workflows, enabling you to manage repositories, issues, pull
requests, and more without leaving your command line. Below are some
essential gh
commands for efficient GitHub management.
View Repository README
Easily access and view the README file of a repository directly from your terminal.
gh repo view
Manage GitHub Issues
List all issues in a repository or view specific issues. You can also create new issues interactively.
# View issue list:
gh issue list
# View specific issue (e.g., the first being #1):
gh issue view 1
# Create issue (start an interactive CLI):
gh issue create
Create and Manage Pull Requests
Streamline your code review process by creating pull requests from your feature branches using an interactive CLI.
# Create pull request from a feature branch (start an interactive CLI):
gh pr create
Create Gists
Quickly create public gists with descriptions and open them in your web browser.
# Create a public gist and open web browser to it:
gh gist create hello.py -d "my Hello-World program in Python" -w -p
Custom Labels
Enhance your issue and pull request organization by creating custom labels.
# Create a custom label for issues and prs
gh label create do-not-merge