I use Git Bash for bitbucket. I have created a bunch and I pushed some commits, other people pushed commits in master as excepted. Now I am at different machine. I want to clone or download the solution of the latest commit of my branch and not the master? How can I do that?
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 ..
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
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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.