I reproduced this just now by accident:I reproduced this just now by accident:
lists the remote branches
git branch -r origin/Feature/f1234 origin/master
I want to checkout one locally, so I cut paste:
git checkout origin/Feature/f1234
Presto! Detached HEAD state
You are in 'detached HEAD' state. [...])
origin/Feature/f1234 origin/master
I want to checkout one locally, so I cut paste:
git checkout origin/Feature/f1234
Presto! Detached HEAD state (git prompts you the message "You are in 'detached HEAD' state. [...]").Solution #1:
See what I did there? I shouldDo not have included "include origin/
" at the front of my branch spec when I was checking it out.:
git checkout Feature/f1234
Solution #2:
Add -b
parameter which creates a local branch from the remote
git checkout -b origin/Feature/f1234
or
git checkout -b Feature/f1234
it will fall back to origin automatically