In Tip 116 you saw you to create a local copy of a remote branch in VS. In today’s tip, you’ll learn how to do this from the command line.
First, let’s verify our current list of branches.
Next, you can use the following git command (provided you only have one remote)
$ git checkout I-am-a-new-branch
It seems that you don’t have to specify the `origin/` part. Git knows to look for corresponding tracking branches.
And you’ll have your local branch.
As I’ve mentioned time and time again, I hate shortcuts when learning things for first time. This SO answer tells me there’s a more complete way.
$ git checkout -b <branch-name> origin/<branch-name>
I gave this a try with my gh-pages branch and sure enough it worked!