Skip to content

gh pr create fails when using -H without appropriate local branch #5290

@mandelsoft

Description

@mandelsoft

Describe the bug

Trying to create a pull request with gh fails if the branch given with -H does not exist locally and has the appropriate content.

Steps to reproduce the behavior

  • create a commit on a local branch based on <base branch>
  • push this commit to a <new remote branch>
  • gh pr create -B <base branch> --fill -H <new remote branch>

Expected vs actual behavior

The pull request should be created. The problems seems to be origin/landscape/prod...landscape/prod-upgrade-2992887. This only works if the given remote branch is identical to a local branch with the same name, that has been used to create the commits. But this must not necessarily be the case.

Logs

$ gh --version
gh version 2.5.2 (2022-03-01)
https://github.com/cli/cli/releases/tag/v2.5.2

$ gh pr create  -B landscape/prod --fill  -H landscape/prod-upgrade-2992887
could not compute title or body defaults: fatal: ambiguous argument 'origin/landscape/prod...landscape/prod-upgrade-2992887': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
/usr/bin/git: exit status 128

Paste the activity from your command line. Redact if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions