Git clone a branch, not master
I think you are looking for the --branch
option to git clone
, which allows you to specify which branch is initially checked out in the cloned repository.
git clone --branch mybranch $URL/foo
is roughly equivalent to
git clone $URL/foo
cd foo
git checkout mybranch
cd ..
You can use below solution:-
Step1: Clone the repo by using below command following by credentials.
git clone <Repository URL>
Step 2: checkout the branch and pull the latest code from there.
git checkout -b <your origin branch>
Step 3: pull the latest code
git pull origin <your origin branch name where latest code is available>
if you use git you can do that easily with git clone -b <name_of_branch> <URL_Repository>
, if you want to pull do git pull origin <name_of_branch> <URL_Repository>
.
Regards