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
- assuming that there is no localfeature
branch and there is only one remote with thefeature
branch.
To set upstream to track the remote branch - type:
git branch --set-upstream-to=<remote>/<branch> <branch>
git branch -u <remote>/<branch> <branch>
where:
<remote>
can be:origin
,develop
or the one created by user,<branch>
is user’s branch to track on remote.
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