Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Purpose of --single-branch in git clone?

Tags:

git

If we use the git clone --branch command, we're only copying the specified branch. What is the additional --single-branch param used fo? The documentation isn't clear to me.

TIA

like image 244
mrahma04 Avatar asked Nov 28 '22 22:11

mrahma04


1 Answers

--branch foo automatically checks out foo after the clone is done but the clone downloads all the branches/tags and their reachable data.

--branch foo --single-branch tells git-clone to download only the data reachable from foo and check out foo.

like image 156
ElpieKay Avatar answered Dec 09 '22 08:12

ElpieKay