git - checkout and track remote branch

Note: in recent git versions, it is enough to do git pull and git checkout feature to checkout and start tracking the remote branch.

Before, it was necessary to use the -t (--track) flag to do that:

#creates and checks out "feature" branch that tracks "origin/feature"
$ git checkout -t origin/feature

Relevant part from the checkout docs:

git checkout [] … If is not found but there does exist a tracking branch in exactly one remote (call it ) with a matching name and –no-guess is not specified, treat as equivalent to $ git checkout -b –track /

profile for Boris Serebrov on Stack Exchange, a network of free, community-driven Q&A sites