'gh pr create' leaves new remote without refs/remotes/<remote>/HEAD
- Dominant language
- Go
- Stars
- 46.3k
- Forks
- 9k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 89
Description
### Describe the bug
After gh pr create auto-forks (or gh repo fork --remote), the new origin remote has no refs/remotes/origin/HEAD. This breaks tools and shorthands that rely on origin/HEAD resolving (e.g. git rev-parse origin, IDEs showing the default branch). Both code paths should run git fetch and git remote set-head -a after adding the remote.
### Affected version
```
gh version 2.63.1 (2024-12-03)
https://github.com/cli/cli/releases/tag/v2.63.1
```
### Steps to reproduce the behavior
1. Type this 'gh pr create'
2. View the output 'git log origin'
3. See error
### Expected vs actual behavior
Expected:
To be able to use the 'origin' shorthand for the forked repo, which I can use for the original cloned remote (which has now been renamed 'upstream').
Actual:
```
fatal: ambiguous argument 'origin'
```
### Logs
```
❯ git log origin
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git [...] -- [...]'
```
Contributor guide
Assessment
This issue has not been assessed yet.