How do I clone a specific Git branch

Blue TeK
Blue TeK
35.6 هزار بار بازدید - 2 سال پیش - Git clone will clone remote
Git clone will clone remote branch into local.

Is there any way to clone a specific branch by myself without switching branches on the remote repository?

git clone -b branch_name remote_repo_url
Example:

git clone -b my-branch [email protected]:user/myproject.git
With Git 1.7.10 and later, add --single-branch to prevent fetching of all branches. Example, with OpenCV 2.4 branch:

git clone -b opencv-2.4 --single-branch https://github.com/Itseez/opencv.git

Courtesy- https://stackoverflow.com/a/4568323



Git clone a branch, not master
How do I clone a single branch in Git?
git - Cloning specific branch
How to clone git repository with specific revision
how to clone a branch in github
git clone --branch to folder
git clone only one branch without history
git checkout specific branch
git pull specific branch from remote
git clone specific tag
git clone all branches
git clone to specific folder
2 سال پیش در تاریخ 1401/03/26 منتشر شده است.
35,634 بـار بازدید شده
... بیشتر