GitHub CLI 2 cheatsheet

GitHub CLI 2: Pull requests

7 common GitHub CLI 2 tasks.

Create a pull request

Open a pull request for the current branch, filling the title and body from your commits.

gh pr create --fill

List pull requests

Show open pull requests in the repository.

gh pr list

Check out a pull request

Fetch a pull request's branch and switch to it.

gh pr checkout 123

View a pull request

Open a pull request in the browser.

gh pr view 123 --web

Check CI status

Show the status of checks on a pull request.

gh pr checks 123

Approve a pull request

Submit an approving review.

gh pr review 123 --approve

Squash-merge and delete the branch

Merge a pull request as a single commit and delete its branch.

gh pr merge 123 --squash --delete-branch

Caution: Merging changes the base branch for everyone. Check the checks and reviews first.

Was this page helpful?