This article is about the head, for the HEAD branch see the current branch page.
In the example below, the branch head of:
CA1--CA2--CA3 <-- Branch A
/
CM1--CM2--CM3 <-- master
\
CB1--CB2 <-- Branch B
Detached head means you are no longer on a branch, you have checked out a single commit in the history
Resolution:
git checkout master
git checkout yourBranch
With the log
git log -n 1 [branch_name]
local: head of the branchs are stored in the git directory in the log directory
ls .git\logs\refs\heads
master
branch-a
branch-b
git ls-remote --heads remote
dd39a644a4a7ec3e65135baaf48acd5f7f628510 refs/heads/master
6ead0945771dfd789aa97442ff10872f9665598d refs/heads/stable
e245797039fa7b86c3a3fb32b45cfb998d8c76cd refs/heads/v1.13
Reset, revert to the head commit of the upstream branch
git reset --hard upstream/master