Gooby
Gooby

Reputation: 733

Sourcetree set HEAD to origin/master

I'm trying to make the HEAD branch with comment "done" the origin/master branch or master branch. Any suggestions? enter image description here

Upvotes: 2

Views: 5616

Answers (1)

axiac
axiac

Reputation: 72266

Open a terminal in the project directory (there is a button on the SourceTree toolbar that does this) and run:

git reflog

It shows the recent positions of the HEAD (the current branch or commit). Yours should start with:

***** HEAD@{0} checkout: moving from xxxxx to master

where xxxxx is a commit hash. It is the hash of the commit you were previously on (shown in the image with commit message "done").

You can check this by running:

git log -n 1 xxxxx

(replace xxxxx in the command above with the actual hash).

If it is, indeed, the commit you need then you can run:

git checkout -B master xxxxx

to make the master branch point to the commit with the message "done".

Read more about git reflog, git branch and git checkout.

Don't double-click rows in SourceTree; it will try to checkout the commit you double-click and you'll end up in a detached HEAD state.

Upvotes: 3

Related Questions