cli / cli/cli

`pr create` prompts for branch when pushed, if cloned with `-- --depth=1 --single-branch`

Open
#9,348 6 comments 0 reactions 0 assignees View on GitHub
bug gh-pr more-info-needed
Dominant language
Go
Stars
46.3k
Forks
9k
Avg merge
2d 9h
Merged PRs (30d)
89

Description

### Describe the bug

`gh pr create` seems to always unconditionally ask where to push the branch, even if it's already been pushed, if the repo has been partially cloned.

```sh
gh --version
gh version 2.53.0 (2024-07-17)
https://github.com/cli/cli/releases/tag/v2.53.0
```

### Steps to reproduce the behavior

See the logs for the long details, but

1. `gh repo clone -- --depth=1 --single-branch`
2. Make a commit on a branch
3. `git push -u origin branch`
4. `gh pr create --fill`
5. It prompts you for where to push your branch

### Expected vs actual behavior

I would expect not to receive a prompt if the branch has already been pushed.

### Logs

[pr-create-bug.log](https://github.com/user-attachments/files/16326902/pr-create-bug.log)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.