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

  1. Install and authenticate the CLI if you have not already.

    gh auth login
  2. From your feature branch, start the interactive pull request workflow.

    gh pr create --fill
  3. Provide reviewers, labels, or projects when prompted, or pass flags like --reviewer to script it.

  4. Use gh pr view --web to 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.