I have a master branch and a version2 branch in github. From the command line in ubuntu how do I retrieve the version 2 branch? I keeps pulling the master branch.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Solution:
Assuming your starting from scratch, first clone the github repo. Github gives nice directions on how to do this when you create a report. Once you have it cloned, type
git checkout -b version2 origin/version2Explanation:
When you clone a repo you automatically get references and all of the commits for each of the branches that are in that repository. The
git checkout -b localBranchName remote/branchNamecommand tells git that you want to create, and checkout, a new local branch that will "track" the remote branchremote/branchName.