Reputation: 252
When running git status
, I get the warning of an ambiguous head:
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
warning: refname 'HEAD' is ambiguous.
On branch develop
Your branch is up to date with 'origin/develop'.
nothing to commit, working tree clean
However, I seem to have neither a branch nor a tag called head, which I claim after running git show-ref
, except for refs/remotes/origin/HEAD
, which is fine as a remote tracking name according to this issue and comment:
https://stackoverflow.com/a/59913481/10112569
$ git show-ref
4839722d12337f7ad7a4df2477d16af1110f2792 refs/heads/develop
c598e3bc2b84146557f943509a6640af628a9c5a refs/heads/feature/JOST-45
f7b8896b8c293b83eb2231de38b96e38897aa8f0 refs/heads/feature/notebook-fixup
efd092d649d3ceab84cbdb3e2914eea54cfe6c35 refs/heads/master
efd092d649d3ceab84cbdb3e2914eea54cfe6c35 refs/remotes/origin/HEAD
7401f244ce01ac53977483af4becf4dc22113c42 refs/remotes/origin/JOST-68-autofocus
4839722d12337f7ad7a4df2477d16af1110f2792 refs/remotes/origin/develop
d5fec66f628654027ae6597535bd947d58eee46c refs/remotes/origin/feature/HiCAT-312
c3bb65bc2f074c6d1b34b625b8481189b5a74613 refs/remotes/origin/feature/JOST-41_env-file
c598e3bc2b84146557f943509a6640af628a9c5a refs/remotes/origin/feature/JOST-45
962b0ac41d391e73f18bf07f727e37ba89335611 refs/remotes/origin/feature/JOST-62-re-org
aed3b6c262a080cc3ec15da57a573c16cade3156 refs/remotes/origin/feature/JOST-67-config-file
a22e5f0e61c943911a38e21011a13be8c6a06b16 refs/remotes/origin/feature/JOST-71-pep8-257
6a894ef9fd4fa8434a3aaf5f741d53e349c8c942 refs/remotes/origin/feature/JOST-79-irisao
fd395cbd862a1ab2fbe130647b70e5fb130b12b8 refs/remotes/origin/feature/iva-run-all
efd092d649d3ceab84cbdb3e2914eea54cfe6c35 refs/remotes/origin/master
8901ca95e15e16cc3126a95ed699b8c842120a4b refs/remotes/origin/release/1.0.0
795cadfa2f8574fbe97197759a5b8b8dad35b4bb refs/stash
041d863133cbdcbb79eb3a92054fed3a2e545599 refs/tags/1.0.0
c54a8fae896316f1d3d4da3ededbc8d5e82fa74f refs/tags/1.0.1
Here is also the result of git branch -a
, since it is a little easier to read:
* develop
feature/JOST-45
feature/notebook-fixup
master
remotes/origin/HEAD -> origin/master
remotes/origin/JOST-68-autofocus
remotes/origin/develop
remotes/origin/feature/HiCAT-312
remotes/origin/feature/JOST-41_env-file
remotes/origin/feature/JOST-45
remotes/origin/feature/JOST-62-re-org
remotes/origin/feature/JOST-67-config-file
remotes/origin/feature/JOST-71-pep8-257
remotes/origin/feature/JOST-79-irisao
remotes/origin/feature/iva-run-all
remotes/origin/master
remotes/origin/release/1.0.0
I have a submodule (repository) within my main repo but I don't think that should be a problem. Both as submodules are a normal thing and today is also the first time I am seeing this warning after having this repo set up like this for over a year.
Would anybody know why I am getting warnings about an ambiguous head? It's usually a scary to work on a detached head and I'd really like to avoid it. Thanks!
Upvotes: 1
Views: 110
Reputation: 1329302
Check your .gitmodules
content.
As I mentioned here, you can set a branch to follow for a submodule.
But... if that branch is "HEAD", then, as shown in this thread, you would get the error message you mention.
Edit the .gitmodules
and remove that "branch" reference.
Upvotes: 1