gh pr create

Create a pull request

Synopsis

Create a pull request

gh pr create [flags]

Options

  -B, --base string    The branch into which you want your code merged
  -b, --body string    Supply a body. Will prompt for one otherwise.
  -d, --draft          Mark pull request as a draft
  -f, --fill           Do not prompt for title/body and just use commit info
  -t, --title string   Supply a title. Will prompt for one otherwise.
  -w, --web            Open the web browser to create a pull request

Options inherited from parent commands

      --help              Show help for command
  -R, --repo OWNER/REPO   Select another repository using the OWNER/REPO format

Examples in use

Interactively

# Create a pull request interactively
~/Projects/my-project$ gh pr create
Creating pull request for feature-branch into master in owner/repo
? Title My new pull request
? Body [(e) to launch nano, enter to skip]
http://github.com/owner/repo/pull/1
~/Projects/my-project$

With flags

# Create a pull request using flags
~/Projects/my-project$ gh pr create --title "Pull request title" --body "Pull request body"
http://github.com/owner/repo/pull/1
~/Projects/my-project$

In the browser

// Quickly navigate to the pull request creation page
~/Projects/my-project$ gh pr create --web
Opening https://github.com/owner/repo/pull/branch in your browser.
~/Projects/my-project$

Working with forks

This command will automatically create a fork for you if you're in a repository that you don't have permission to push to.