HEAD branch is behind master in SourceTree

Somewhat new to source control and Sourcetree.I checked out a previous commit and it created a HEAD branch (that is not acting like a branch at all).

I want to go back to only having one branch (master). Please help!

2 answers

1 accepted

Accepted Answer
2 votes

so what I found is that I needed to create a branch from my "HEAD" branch (which isn't really a branch at all) using the new branch command. At that point head is gone! yay! Then I was able to merge that branch with master and delete the unwanted branch I had created from HEAD.

You could also have checked out an existing branch, then used right-click on the latest commit and selected Reset <branch> to this commit to move the branch pointer to where you want it to be.

When HEAD is displayed, it means that you're on a detached HEAD, which means you have no branch checked out and any commits won't move any branches when they're made. If you checkout a detached HEAD in SourceTree, it will warn you fairly obviously, so maybe this was done on the command line beforehand and you saw the after effects in SourceTree.

@edwon 's advice worked for me

@steve did not; when I cheked out an existing branch, I lost of my my changes on a detached HEAD (luckily did a backup beforewards).

Suggest an answer

Log in or Sign up to answer
Community showcase
Published yesterday in Jira Ops

Jira Ops Early Access Program Update #1: Announcing our next feature and a new integration

Thanks for signing up for Jira Ops! I’m Matt Ryall, leader for the Jira Ops product team at Atlassian. Since this is a brand new product, we’ll be delivering improvements quickly and sharing updates...

186 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you