OK, there are a number of ways to setup tracking remote branches with git. We need that so we can use push and pull commands without long explaining what to push/pull where… I’d say that normally all we mortals need is to assume that the remote branch will be called the same as the local one, so with this assumption it really can be all easy and clean.
So we have 2 cases:
- Push new local branch to remote, and setup tracking:
git push -u origin branchname
- Pull new remote branch, and setup tracking
git checkout -b branchname --track origin/branchname