git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bug: `git remote show <remote>` reports different HEAD branch than refs/remotes/<remote>/HEAD
@ 2017-08-15 14:26 Jason Karns
  2017-08-15 17:09 ` Igor Djordjevic
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Karns @ 2017-08-15 14:26 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-08-15 21:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-15 14:26 Bug: `git remote show <remote>` reports different HEAD branch than refs/remotes/<remote>/HEAD Jason Karns
2017-08-15 17:09 ` Igor Djordjevic
2017-08-15 17:58   ` Jason Karns
2017-08-15 21:59     ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).