git: checkout and track remote branch
Note: in recent git versions, it is enough to do git pull and
git checkout branch-name to check out and start tracking the remote branch.
Before, it was necessary to use the -t (--track) flag to do that:
#creates and checks out "branch-name" branch that tracks "origin/branch-name"
git checkout -t origin/branch-name
The relevant part of the checkout docs:
git checkout [<branch>]…
If
<branch>is not found but there does exist a tracking branch in exactly one remote (call it<remote>) with a matching name and--no-guessis not specified, treat as equivalent to
$ git checkout -b <branch> --track <remote>/<branch>