One of my developers (no longer at my company) managed somehow to create a branch called HEAD on our BitBucket server (v4.14.0). Either that or it's not a true branch but displaying as a branch because it's a reference to the head of Master. Not sure but nothing I do seems to move it or fix it.
In SourceTree > Terminal
$ git branch -r
origin/HEAD -> origin/master
origin/development
origin/master
$ git remote show origin
* remote origin
Fetch URL: http://username@bitbucket.mycompany.org/scm/isc/cms-machine-readable-json.git
Push URL: http://username@bitbucket.mycompany.org/scm/isc/cms-machine-readable-json.git
HEAD branch: master
Remote branches:
development tracked
master tracked
Local branches configured for 'git pull':
development merges with remote development
master merges with remote master
Local refs configured for 'git push':
development pushes to development (local out of date)
master pushes to master (up to date)
Sounds like a detached head but every blog I find describes how to fix this locally in SourceTree, but I cannot clone or check out HEAD to local, it says it's ambiguous (apparently references both the hash of a commit and the head of the master branch?) I also cannot merge HEAD into Master or delete HEAD in BitBucket for the same reason.
I know I can create a brand new repo and drop in the latest files, but I'll lose all the change history in the current repo, I'd rather not do that. I also want to know how this happened so we can void it in the future. Any ideas how to fix this?
The solution is here you have a detached head which is not supported and you need to related it back to the master branch to activate the branch properly. I would copy the contents out of the branch in case you need to save any work that was done.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.