Reputation: 5061
I'm fairly new to git. Currently I try to follow this tutorial to overlay the icon of my app with branch name and version: http://www.merowing.info/2013/03/overlaying-application-version-on-top-of-your-icon/
I get however an error when executing
git rev-parse --abbrev-ref HEAD
warning: refname 'HEAD' is ambiguous.
error: refname 'HEAD' is ambiguous
googling brought up some results suggesting that this happens when there is a branch named 'HEAD' - but I don't think that's the case. At least in the online repository on bitbucket I don't see any branch labeled 'HEAD' and querying it through the terminal yields:
git branch -r
origin/#224-Push-notifications
origin/1.0.2
origin/HEAD -> origin/master
origin/app-forced-update
origin/master
origin/milestone6
origin/staging
git branch
* #224-Push-notifications
1.0.2
HEAD
master
milestone3
milestone4
milestone5
milestone6
not sure why on the remote HEAD there is a -> while on the local HEAD there is none. maybe that's the problem?
also, searching for HEAD in the .git folder yields
find .git -name HEAD
.git/HEAD
.git/logs/HEAD
.git/logs/refs/heads/HEAD
.git/logs/refs/remotes/origin/HEAD
.git/refs/heads/HEAD
.git/refs/remotes/origin/HEAD
anyone understands what's the issue and how I can cleanly resolve it?
Upvotes: 3
Views: 8474
Reputation: 1
It's thinking that local is copy of remote, which always as a current is marked HEAD. When it isn't it don't know how to treat it. Locally or Pull from remote. You can change name for local HEAD, by
git branch -m HEAD newbranch
Upvotes: 0
Reputation: 42872
The results of git branch
show that you have a brach called HEAD. Looks like you inherited it from origin.
You can safely remove it from your copy using
git branch -d HEAD
Upvotes: 4
Reputation: 697
You've got a local branch called HEAD, so git doesn't know whether you're referring to that or the HEAD, which is the latest commit in the current branch. It's not a good idea to name a branch HEAD, so you should delete it: git branch -D HEAD
. This'll fix the rev-parse error.
origin/HEAD -> origin/master
in the remote branches is a remote-specific thing that means the master branch will be checked out when you clone from the remote.
Upvotes: 4