1

Lost reference to origin/HEAD.

When I execute command git branch -r, I see just these branches.

git branch -r
  origin/master
  origin/some-other-branch

How can I get origin/HEAD linked back to origin/master

origin/HEAD -> origin/master
origin/master
origin/some-other-branch
java_dude
  • 4,038
  • 9
  • 36
  • 61

2 Answers2

2

You can locally set it with:

git remote set-head origin master
git remote set-head origin -a

But it is supposed to be set on the upstream repo itself (and in your local repo when cloning the upstream repo).
See "How does origin/HEAD get set?".

That means, it remains a local setting to your local repo, and has no influence on the actual HEAD of the upstream repo (hence the -a option to get it from the upstream repo itself).

See more at "Change a Git remote HEAD to point to something besides master".

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1
git remote set-head origin -a 

credited to Robert Siemer How does origin/HEAD get set?

Community
  • 1
  • 1
java_dude
  • 4,038
  • 9
  • 36
  • 61