Back

Explore Courses Blog Tutorials Interview Questions
+7 votes
3 views
in DevOps and Agile by (19.7k points)

I would like to know how I could clone only one branch instead of cloning the whole Git repository.

1 Answer

+11 votes
by (62.9k points)

From the announcement Git 1.7.10 (April 2012):

git clone learned --single-branch option to limit cloning to one branch (surprise!); tags that don't point into the history of the branch aren't fetched.

Git really permits you to clone only 1 branch, for example:

git clone -b mybranch --single-branch git://sub.domain.com/repo.git

Related questions

+1 vote
1 answer
0 votes
1 answer
0 votes
1 answer
+1 vote
1 answer
0 votes
1 answer

Browse Categories

...