git fetch git branch --track branch-name origin/branch-name
First command makes sure you have remote branch in local repository. Second command creates local branch which tracks remote branch. It assumes that your remote name is
originand branch name is
--track option is enabled by default for remote branches and you can omit it.
—————————- OR ——————————————————–
First of all you have to fetch the remote repository:
git fetch remoteName
Than you can create the new branch and set it up to track the remote branch you want:
git checkout -b newLocalBranch remoteName/remoteBranch
You can also use “git branch –track” instead of “git checkout -b” as max specified.
git branch --track newLocalBranch remoteName/remoteBranch