Skip to content

gh pr create does not work in non-interactive mode starting with v2.18.0 #6468

@grchiu-intel

Description

@grchiu-intel

Describe the bug

gh pr create when run non-interactively no longer works, a git bisect shows that it started happening after 2944f7c was merged.

Steps to reproduce the behavior

  1. Clone a GitHub repository
  2. Add a fork with gh repo fork --remote --remote-name=fork
  3. Create empty commit with git commit -m empty --allow-empty
  4. Push commit to fork with git push -u fork
  5. Attempt to create a PR (non-interactively) gh pr create --fill < /dev/null
  6. See error

Expected vs actual behavior

With v2.17.0 (expected behavior)

> gh --version
gh version 2.17.0 (2022-10-04)
https://github.com/cli/cli/releases/tag/v2.17.0

> gh pr create --fill < /dev/null
(successful creation of the PR)

With v2.18.0 (incorrect behavior)

> gh --version
gh version 2.18.0 (2022-10-18)
https://github.com/cli/cli/releases/tag/v2.18.0

> gh pr create --fill < /dev/null
aborted: you must first push the current branch to a remote, or use the --head flag

It looks like the above is caused by commit 2944f7c.

Logs

See above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triageneeds to be reviewed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions