Git clones some files

Source: Internet
Author: User
Tags svn
git clones some files Demand

Just want to get the specified files or folders out of the Git repository. In SVN, this is very easy to implement, because SVN is stored in file mode, and Git is a metadata-based distributed store of file information, it will be in every clone of the time to retrieve all the information to the local, that is equivalent to build a clone version of the repository on your machine. Solution Solutions

This was not possible until Git1.7.0, but fortunately the sparse checkout mode was added after Git1.7.0, which made it possible to specify a file or folder for check out. Example

The following is an example of the/druid/doc directory under the clone Open source project Druid.

$ mkdir Druid
$ cd Druid  
$ git init//Initialize empty warehouse
$ git Remote add-f origin https://github.com/alibaba/druid.git Associate Remote Address
$ git config core.sparsecheckout true//Open sparse Checkout mode
$ echo "Druid/doc" >>. Git/info/spars E-checkout//Set required check out file
$ Git pull origin master//check out ...
Summary Specifies the remote repository specified clone mode: Sparse clone mode Specifies the cloned folder (or file) to pull the remote file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.