How to clone specific branch from github, gitlab etc

How to clone specific branch from github, gitlab etc

Example:

git clone -b <branch> <remote_repo>

or

git clone --single-branch --branch <branchname> <remote-repo>
The --single-branch option is valid from version 1.7.10 and later.
You may also want to make sure you understand the difference. 
And the difference is: 
by invoking git clone --branch <branchname> url you're fetching all the branches and checking out one.
How to clone specific branch from github, gitlab etc How to clone specific branch from github, gitlab etc Reviewed by TechTubeHQ on May 05, 2024 Rating: 5

No comments:

Powered by Blogger.