There 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 local feature
branch and there is only one remote with the feature
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