Bug: `git remote show <remote>` reports different HEAD branch than refs/remotes/<remote>/HEAD
From: Jason Karns <hidden>
Date: 2017-08-15 14:26:45
I have a git repo that shows a different branch in `.git/refs/remotes/origin/HEAD` than is reported by `git remote show origin`. The branch is `github-rename` in refs/remotes/origin/HEAD, but shows `master` in output of git-remote-show
$ cat .git/refs/remotes/origin/HEAD
ref: refs/remotes/origin/github-rename
$ git remote show origin
* remote origin
Fetch URL: git@XXXX.git
Push URL: git@XXXX.git
HEAD branch: master
Remote branches:
github-rename tracked
master tracked
qa tracked
refactor-test tracked
Local branches configured for 'git pull':
github-rename merges with remote github-rename
master merges with remote master
Local refs configured for 'git push':
github-rename pushes to github-rename (up to date)
master pushes to master (up to date)
git version 2.14.1 Background: Prior to my repo being cloned, the default branch was configured to be `some-random-branch` on github. My repo was cloned and the HEAD branch was set to `some-random-branch` correctly (in `refs/`). However, git-remote-show reported `master` as the HEAD branch. Later, `some-random-branch` was deleted from the remote. It _remained_ as the HEAD branch locally according to `refs/`. In order to test the remote-show command, I changed the HEAD branch to a branch that actually existed by running `git remote set-head origin github-rename`. It changed the HEAD branch in `refs/` but remote-show continues to report `master` as the remote's HEAD. Thanks, Jason Karns