As far as I can tell everything in my git local repository is fine. I can commit, push, pull, whatever I like.
However, when I view the details of a commit in the In
origin/head
sounds like it refers to the default branch set in your remote origin repo. For example, when I do git branch -a
, I see this show up in the list:
remotes/origin/HEAD -> origin/master
You might be missing this reference in your local repo, or your local repo's reference might be out of date, if the default branch is changed in the remote, and the old default is deleted.
If this is indeed the cause of your IDE error, then you can manually correct it using git symbolic-ref
:
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/<default-branch>
Where <default-branch>
is the branch that is default in your remote repo.
So git actually has a more convenient command that can be used to update a local repo's symbolic-ref to the default branch in a remote repo:
git remote set-head <remote> --auto
# Or shorter
git remote set-head <remote> -a
It was introduced in commit bc14fac for git 1.6.3 (May 2009).
Sets or deletes the default branch (
$GIT_DIR/remotes/<name>/HEAD
) for the named remote.
Having a default branch for a remote is not required, but allows the name of the remote to be specified in lieu of a specific branch.
For example, if the default branch fororigin
is set tomaster
, thenorigin
may be specified wherever you would normally specifyorigin/master
.