I run:
git checkout mygithub/master
but for some reason, running ‘git status’ shows “not currently on any branch”. Running:
git checkout master
and then git status, says that I’m now on branch master. Now I want to switch to another branch. Running git checkout anotherbranch works, but git status says I am still on branch ‘master’. What am I doing wrong?
mygithub/masteris a remote branch. To create a local branch based off of that remote branch, you have to usegit checkout -b mymaster mygithub/master. Git tries to make this easy for you: if you writegit checkout branchname, and branchname only exists in a remote, but not locally, Git will automatically set up a local branch with<remote>/branchnamebeing its parent.