- Apr 4, 2016
If you know the branch you want, all you have to do is the following in a console:
git fetch && git checkout remoteBranchName
If you don't know for sure the branch you want, we can easily list all options. Issue the first part of the command
This will update your computer with all the code and branches that are on the remote repository. Now we can type the following to get all available options
git branch --all
git branch -a
Now you finish the checkout with
git checkout remoteBranchName
You should see some output that looks similar to
Branch remoteBranchName set up to track remote branch remoteBranchName from origin.
Switched to a new branch 'remoteBranchName'
Now you're all set to develop on a branch that was created remotely. Don't forget you will have to commit and push (or create a pull request) any changes you make before your teammates can see them, and always remember to pull before you push!