Here's an extract from the docs:
Sets or deletes the default branch (i.e. the target of the symbolic-ref refs/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 for origin is set to master, then origin may be specified wherever you would normally specify origin/master.
With -d, the symbolic ref refs/remotes/<name>/HEAD is deleted.
With -a, the remote is queried to determine its HEAD, then the symbolic-ref refs/remotes/<name>/HEAD is set to the same branch. e.g., if the remote HEAD is pointed at next, "git remote set-head origin -a" will set the symbolic-ref refs/remotes/origin/HEAD to refs/remotes/origin/next. This will only work if refs/remotes/origin/next already exists; if not it must be fetched first.
Use <branch> to set the symbolic-ref refs/remotes/<name>/HEAD explicitly. e.g., "git remote set-head origin master" will set the symbolic-ref refs/remotes/origin/HEAD to refs/remotes/origin/master. This will only work if refs/remotes/origin/master already exists; if not it must be fetched first.
I've made the command bold, and it's saying in the paragraph eariler that you use "-d" to delete that symbolic ref. So you're saying the remote ref HEAD should be deleted. However, in my local test case there is no remote branch HEAD so technically this command wouldn't work. It's a local branch here and not a remote one. This can be seen within SourceTree itself quite easily in the sidebar if you expand origin, so deleting the remote ref won't do anything.
So, if HEAD branch is only local then you'd need to use
git branch -D HEAD
...but please make sure you back your repository up first to make sure you're not losing any changes from this. Technically you shouldn't as it's only a branch pointer to the HEAD commit if you've checked something out, but as I say, it's not doing any harm being there.
HEAD is a pointer to a commit (usually master) so when you checkout your repository the commit which HEAD points at will be checked out. Usually you'd want it if when checking out you want a different branch or tag to be checked out.
You can take a look at what it's pointing out by issuing the following command:
git branch -r
And you'll probably see something like the following:
origin/HEAD -> origin/master
You can delete HEAD if you don't need it (although it doesn't do any harm being there) by issuing the following command:
git remote set-head origin -d
Hope that helps
Thanks for your help I really appreciate it, but I'm afraid it didn't work... I opened Terminal from the icon next to the git flow icon on the top, and I entered: git remote set-head origin -d But apparently it didn't remove the branch (I did restart SourceTree)... am I doing something wrong?
Hello Community, I’m Anton Genkin, a product manager on the Bitbucket Server and Data Center team and am excited to share that Bitbucket Server 7.0 is now available! It's a platform release, one th...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events