I think what you're looking for is a way to acquire a local copy of a remote branch to work on:
git checkout -b localbranch origin/path/to/branch
This will create a new branch named localbranch
locally set up to track the branch path/to/branch
from the origin, and switch to it immediately. You can name it whatever you like, but personally I usually name it exactly the same as the origin. Alternatively you could separate out the commands if you want to do things step by step:
git branch localbranch origin/path/to/branch
git checkout localbranch
The first command here creates the local branch, and sets it up to track the remote branch, but does not switch to it. These are the ways to create a local branch that tracks a remote branch. git pull
and git push
are used afterwards to sync snapshots. I would definitely recommend reading through the git tutorial to get a better understanding of all this: https://git-scm.com/doc.