Sidenote: With modern Git (>= 1.6.6), you are able to use just
git checkout test
(note that it is 'test' not 'origin/test') to perform magical DWIM-mery and create local branch 'test' for you, for which upstream would be remote-tracking branch 'origin/test'.
The * (no branch)
in git branch
output means that you are on unnamed branch, in so called "detached HEAD" state (HEAD points directly to commit, and is not symbolic reference to some local branch). If you made some commits on this unnamed branch, you can always create local branch off current commit:
git checkout -b test HEAD
I found a comment buried below which seems to modernize this answer:
@Dennis:
git checkout <non-branch>
, for examplegit checkout origin/test
results in detached HEAD / unnamed branch, whilegit checkout test
orgit checkout -b test origin/test
results in local branchtest
(with remote-tracking branchorigin/test
as upstream) – Jakub Narebski Jan 9 '14 at 8:17
emphasis on git checkout origin/test