Open a Pull Request from the CLI
Use <code>gh</code> to compare branches, fill the PR template, and submit without touching the browser.
Overview
The GitHub CLI shines when you want to script updates or avoid context switching. This scenario walks through turning a reviewed feature branch into an open pull request.
Steps
-
Install and authenticate the CLI if you have not already.
gh auth login -
From your feature branch, start the interactive pull request workflow.
gh pr create --fill -
Provide reviewers, labels, or projects when prompted, or pass flags like
--reviewerto script it. -
Use
gh pr view --webto open the PR in your browser if you need to adjust settings post-creation.
Tip
Pass --draft when the work is not yet ready for review to prevent accidental merges.