Repository navigation
Open
Labels
bugSomething isn't workingcoreThis issue is not accepting PRs from outside contributorsgh-prrelating to the gh pr commandpriority-3Affects a small number of users or is largely cosmeticstale
Description
Describe the bug
pr-create seems to fail if the branch has an explicit upstream whose name differs from the local name.
Affected version
$ gh version
gh version 2.86.0 (2026-01-21)
https://github.com/cli/cli/releases/tag/v2.86.0
Steps to reproduce the behavior
- local branch:
db-migrations-squash-prep - branches upstream:
origin/db-migrations-squash - branch is already pushed
- ran
gh pr create --fill-verbose
Expected vs actual behavior
I expected it to open a PR with the upstream branch origin/db-migrations-squash as HEAD and origin/master as BASE; using the contents of all the commit messages as the PR body.
Instead, I got an error:
could not compute title or body defaults: failed to run git: fatal: ambiguous argument 'origin/master...db-migrations-squash': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Logs
Paste the activity from your command line. Redact if needed.
$ GH_DEBUG=true gh pr create --fill-verbose
[git remote -v]
[git config --get-regexp ^remote\..*\.gh-resolved$]
* Request at 2026-02-27 14:39:09.636374 -0500 EST m=+0.057064001
* Request to https://api.github.com/graphql
* Request took 378.510916ms
[git status --porcelain]
[git symbolic-ref --quiet HEAD]
[git config --get-regexp ^branch\.db-migrations-squash-prep\.(remote|merge|pushremote|gh-merge-base)$]
[git rev-parse --symbolic-full-name db-migrations-squash-prep@{push}]
[git show-ref --verify -- HEAD refs/remotes/origin/db-migrations-squash]
[git -c log.ShowSignature=false log --pretty=format:%H%x00%s%x00%b%x00 --cherry origin/master...db-migrations-squash]
could not compute title or body defaults: failed to run git: fatal: ambiguous argument 'origin/master...db-migrations-squash': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Related
I think these may be related?
gh pr createwith--fill-firstfails when head branch exists only remotely #12394- gh pr create --fill fails with confusing error: could not compute title or body defaults: fatal: ambiguous argument #5896
- gh pr create assumes that local and remote branch names match #11041
- PR creation has strange behaviour when remote changes #1032
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingcoreThis issue is not accepting PRs from outside contributorsgh-prrelating to the gh pr commandpriority-3Affects a small number of users or is largely cosmeticstale
Activity
[-]`pr create` fails to construct PR message[/-][+]`pr create` fails when local branch name differs from upstream[/+]jasonkarns commentedon Feb 27, 2026
I renamed the remote (upstream) branch name to match the local one, and then the command worked.
gh-cli should not be making the assumption that the local and remote ref names match. Indeed, git is already aware of the explicit tracking upstream. So gh should be respecting that.
babakks commentedon Mar 9, 2026
Thanks for reporting this, @jasonkarns! 🙏
This is a known issue. We've been tracking it in #11503 and I have a draft fix in #11844 that aims to preserve the existing upstream tracking ref when
gh pr createpushes the branch, rather than overwriting it with the local branch name.That said, it's not a straightforward fix, as I vaguely remember some issues when I was testing the PR, which I had to put aside in favour of other priorities.
babakks commentedon Mar 9, 2026
I didn't mark it as a duplicate, though, since there maybe difference here.
Fix `pr create --fill` when local branch name differs from remote
gh pr create --fillfails when the remote branch name is different #13308 as a duplicate of this issue