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

4 Answers
4

From the announcement Git 1.7.10 (April 2012):

  • git clone learned --single-branch option to limit cloning to a single branch (surprise!); tags that do not point into the history of the branch are not fetched.

Git actually allows you to clone only one branch, for example:

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

Note: Also you can add another single branch or “undo” this action.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *