Check out a new branch tracking a remote branch
suggest changeThere are three ways of creating a new branch feature which tracks the remote branch origin/feature:
git checkout --track -b feature origin/feature,git checkout -t origin/feature,git checkout feature, if there is no localfeaturebranch and only one remote has afeaturebranch.
To set the upstream of an existing local branch:
git branch --set-upstream-to=<remote>/<branch> <branch>git branch -u <remote>/<branch> <branch>
<remote> is a remote name such as origin. <remote>/<branch> is the upstream branch. The final <branch> is the local branch; omit it to use the current branch.
To verify which remote branches your local branches are tracking:
git branch -vv
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents