GitHub CLI

GitHub CLI Cheatsheet #

GitHub CLI (gh) is a command-line tool for interacting with GitHub, allowing you to manage your GitHub repositories, issues, pull requests, and more directly from your terminal. It simplifies workflows by providing a direct interface to GitHub’s features and API.

Authentication #

Command/OptionExampleDescription
gh auth logingh auth loginAuthenticate with GitHub
gh auth logoutgh auth logoutLog out of GitHub
gh auth statusgh auth statusView authentication status

Repository Management #

Command/OptionExampleDescription
gh repo creategh repo create my-repoCreate a new repository
gh repo clonegh repo clone owner/repoClone a repository
gh repo forkgh repo fork owner/repoFork a repository
gh repo viewgh repo view owner/repoView a repository in your browser
gh repo listgh repo listList repositories

Issues and Pull Requests #

Command/OptionExampleDescription
gh issue listgh issue listList issues in a repository
gh issue viewgh issue view 123View an issue
gh issue creategh issue createCreate a new issue
gh pr listgh pr listList pull requests in a repository
gh pr viewgh pr view 123View a pull request
gh pr creategh pr createCreate a new pull request
gh pr checkoutgh pr checkout 123Check out a pull request locally

Managing Pull Requests #

Command/OptionExampleDescription
gh pr mergegh pr merge 123Merge a pull request
gh pr closegh pr close 123Close a pull request
gh pr reopengh pr reopen 123Reopen a pull request
gh pr reviewgh pr review 123Add a review to a pull request
gh pr checksgh pr checks 123View the status of checks for a pull request

Managing Issues #

Command/OptionExampleDescription
gh issue closegh issue close 123Close an issue
gh issue reopengh issue reopen 123Reopen an issue
gh issue commentgh issue comment 123 --body "Your comment"Comment on an issue

Working with Gists #

Command/OptionExampleDescription
gh gist creategh gist create myfile.txtCreate a new gist
gh gist listgh gist listList your gists
gh gist viewgh gist view 123View a gist
gh gist deletegh gist delete 123Delete a gist

Notifications #

Command/OptionExampleDescription
gh notification listgh notification listList notifications
gh notification mark-readgh notification mark-read 123Mark a notification as read

Configurations #

Command/OptionExampleDescription
gh config setgh config set editor vimSet a configuration value
gh config getgh config get editorGet a configuration value
gh config listgh config listList all configuration values

This cheatsheet covers the most commonly used GitHub CLI commands and options, helping you to manage repositories, issues, pull requests, gists, notifications, and more.

GitHub CLI

Explore our comprehensive cheatsheets to enhance your knowledge and efficiency. Each cheatsheet provides detailed command options, examples, and descriptions to help you master various tools and technologies.