xxxxxxxxxx
# Fetch the latest updates from the remote repository
git fetch
# Switch to the remote branch
git checkout origin/branch-name
xxxxxxxxxx
# In order to checkout a remote branch,
# you have to first fetch the contents of the branch
git fetch --all
# In mordern version of Git, cehckout the remote branch like a local branch
git checkout <remotebranch>
# Older versions of Git requiers the creation of a new branch based on the remote
git checkout -b <remotebranch> origin/<remotebranch>
xxxxxxxxxx
git checkout -b test origin/test
// making a local copy of the branch called "test" from origin.
xxxxxxxxxx
$ git checkout --track origin/newsletter
Branch newsletter set up to track remote branch newsletter from origin.
Switched to a new branch 'newsletter'
xxxxxxxxxx
# In modern versions of Git, you can checkout the remote branch like a local branch.
git checkout <remotebranch>
# Older versions of Git require the creation of a new branch based on the remote.
git checkout <remotebranch> origin/<remotebranch>
xxxxxxxxxx
$ git checkout -t origin/remote-branch
Branch 'remote-branch' set up to track remote branch 'remote-branch' from 'origin'.
Switched to a new branch 'remote-branch'
xxxxxxxxxx
$ git checkout --track origin/newsletter
Branch newsletter set up to track remote branch newsletter from origin.
Switched to a new branch 'newsletter'