github-cli cheatsheet

The GitHub CLI is a tool to interact with GitHub via your command line. See for more information.

This is my cheat-sheep 🐑. It covers most of my use cases but is neither feature-complete nor claims to be correct. Feel free to use/copy/modify it, but use it with caution.


gh help                        # Print help message
gh auth login                  # Login to GitHub

gh status                      # List ongoing things and notifications

Pull requests

gh pr --help                   # Print help for the pull-request command

gh pr list                     # List currently open pull-requests
gh pr view                     # View pull-request of current branch
gh pr create                   # Create PR based on current branch
gh pr ready                    # Mark PR as ready-for-review
gh pr status                   # List the status of the PR for the current branch

# Review commands
gh pr checks ID                # Show CI status of a single pull-request
gh pr diff ID                  # List changes of a pull-request

gh pr review ID                # Add a review (let's you select Comment, Approve or Request changes)
gh pr merge ID                 # Merge pull-request


gh gist --help                 # Print gist help

gh gist list                   # List my gists
gh gist view HASH              # View a gist
gh gist create < FILE          # Create gist from FILE
gh gist edit HASH              # Edit a gist
gh gist delete HASH            # Delete a gist
Licensed under CC BY-NC-SA 4.0
Last updated on Jul 01, 2022 09:42 +0200