First PR is gh pr create, not a website click
The first real PR is gh pr create in the terminal.
Clicking Compare & pull request after git push is the long way. The first real PR is gh auth login, then gh pr create; success prints the PR URL. To put branch and base on one sheet, start a room。
The GitHub CLI manual: when the current branch is not fully pushed, gh pr create asks where to push and can offer a fork. Do not push first, then hunt the website.
Finish the first PR in the terminal
- 01Log in before you open the site
Install
ghfromcli.github.com. Default host isgithub.com. Rungh auth login: the default is a browser OAuth flow; the token goes in the system credential store. Usegh auth statusto see the host and where the token lives. - 02Create from the feature branch
Check out the branch you want merged. If it is not fully pushed, the command prompts for a remote.
--headskips forking or pushing. Set the merge target with--base; otherwisegh-merge-base, then the repo default branch. - 03Pass title and body as flags
Interactive mode asks for Title and Body. Skip with
--titleand--body.--filluses commit messages; flags win if both are set. Success prints the PR URL. Alias:gh pr new. - 04
--websends you back to the browsergh pr create --webonly opens the create page. First success is a printedhttps://github.com/…/pull/N, not another Compare click.
gh auth login
gh auth status
# on your feature branch:
gh pr create --title "The bug is fixed" --body "Everything works again"
# or fill title/body interactively; push when prompted
# docs: cli.github.com/manual/gh_pr_createYou think a PR exists. It does not
| Action | You assume | What happens |
|---|---|---|
git push then GitHub in a browser | A PR already exists | Only a remote branch exists until you create a pull request |
gh pr create --web | The CLI already opened the PR | It only opens the browser create page |
gh pr create with no login | It will finish login and create in one go | Run gh auth login first; default is the browser flow |
--fill + --title | Both get concatenated | Title and body flags overwrite autofill |
After the first PR, still watch these
- Draft
--draftstill prints a URL; the PR is not ready to merge.- Reviewers
--reviewer loginor a team handle. Official example:gh pr create --reviewer monalisa,hubot --reviewer myorg/team-name.- Dry-run
--dry-runprints details instead of creating a PR. The manual says it may still push git changes.
To mark base, head, and reviewers on one sheet for the team, open a frogmeet room: send the id, about one hour, eight people max, no account. Details on features。
FAQ
gh says you are not authenticated?
Run gh auth login. Default host github.com, browser flow. Enterprise: --hostname. Or --with-token with a classic PAT on stdin (minimum scopes: repo, read:org, gist).
It asks where to push?
The current branch is not fully on a remote. That prompt is expected. Pick a remote or fork; use --head to skip fork/push.
How is this different from Compare on the website?
Compare still leaves the terminal. gh pr create prints the URL on success. Only --web opens the browser create page.