gh pr create
Open a pull request from the current branch
What it does
gh pr create opens a pull request from the branch you are on. If the branch is not on GitHub yet, gh offers to push it. With no flags it asks for the title, the description and what to do next.
--fill takes the title and description from the commits and asks nothing. --title and --body set them explicitly; Closes #12 in the description closes issue 12 when the PR is merged. --draft creates a draft, --base changes the target branch, and --reviewer asks for a review right away.
Syntax
gh pr create --fill
gh pr create --title "<title>" --body "<description>"
gh pr create --draft --base <branch>Examples
Open a pull request from the current branch, with the title and description taken from the commits
gh pr create --fillsame as:
gh pr create -fpr— pull requestscreate— open a new one--fill— title and description from the commits, no questions
Open a pull request titled "Fix login" with a description that closes issue 12
gh pr create --title "Fix login" --body "Closes #12"same as:
gh pr create -t "Fix login" -b "Closes #12",gh pr create --title 'Fix login' --body 'Closes #12',gh pr create -t 'Fix login' -b 'Closes #12'pr create— open a pull request--title "Fix login"— the title--body "Closes #12"— the description; Closes #12 closes the issue on merge
Related commands
- git push — Send your commits to the server
- gh pr view — Read a pull request: description, status and reviews
- gh pr ready — Mark a draft pull request as ready for review