gh pr create
Create a pull request
Create a pull request on GitHub.
When the current branch isn't fully pushed to a git remote, a prompt will ask where to push the branch and offer an option to fork the base repository. Use '--head' to explicitly skip any forking or pushing behavior.
A prompt will also ask for the title and the body of the pull request. Use '--title' and '--body' to skip this, or use '--fill' to autofill these values from git commits.
gh pr create [flags]
$ gh pr create --title "The bug is fixed" --body "Everything works again" $ gh pr create --reviewer monalisa,hubot $ gh pr create --project "Roadmap" $ gh pr create --base develop --head monalisa:feature
-a, --assignee login Assign people by their login -B, --base branch The branch into which you want your code merged -b, --body string Body for the pull request -d, --draft Mark pull request as a draft -f, --fill Do not prompt for title/body and just use commit info -H, --head branch The branch that contains commits for your pull request (default: current branch) -l, --label name Add labels by name -m, --milestone name Add the pull request to a milestone by name -p, --project name Add the pull request to projects by name --recover string Recover input from a failed run of create -r, --reviewer login Request reviews from people by their login -t, --title string Title for the pull request -w, --web Open the web browser to create a pull request
Options inherited from parent commands
--help Show help for command -R, --repo [HOST/]OWNER/REPO Select another repository using the [HOST/]OWNER/REPO format
# Create a pull request interactively ~/Projects/my-project$ gh pr create Creating pull request for feature-branch into main 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$
# 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.