Skip to content

gh pr create --web fails if branch name contains a forward slash #10857

@pdunnavant

Description

@pdunnavant

Describe the bug

I have a branch created with a name of TICKET/test-name. In github-cli versions prior to 2.71.0, gh pr create --web worked successfully. As of 2.71.0, the command fails with an error:

➜ gh pr create --web
remote tracking branch must have format refs/remotes/<remote>/<branch> but was: refs/remotes/origin/TICKET/test-name

Affected version

Please run gh version and paste the output below.

➜ gh version
gh version 2.71.0 (2025-04-23)

Steps to reproduce the behavior

  1. Create a branch with a name containing a forward slash.
  2. Run gh pr create --web
  3. See error

Expected vs actual behavior

I'd expect the PR to be created successfully.

Logs

➜ GH_DEBUG=true gh pr create --web
[git remote -v]
[git config --get-regexp ^remote\..*\.gh-resolved$]
* Request at 2025-04-24 15:06:27.579786 +0900 JST m=+0.115545042
* Request to https://api.github.com/graphql
* Request took 749.412042ms
[git status --porcelain]
[git symbolic-ref --quiet HEAD]
[git config --get-regexp ^branch\.TICKET/test-name\.(remote|merge|pushremote|gh-merge-base)$]
[git rev-parse --symbolic-full-name TICKET/test-name@{push}]
[git config push.default]
[git config remote.pushDefault]
[git show-ref --verify -- HEAD refs/remotes/origin/TICKET/test-name]
remote tracking branch must have format refs/remotes/<remote>/<branch> but was: refs/remotes/origin/TICKET/test-name

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcoreThis issue is not accepting PRs from outside contributorsgh-prrelating to the gh pr commandp1Affects a large population and inhibits work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions