"Go" git How to check out the specified file or folder
Http://www.handaoliang.com/a/20140506/195406.html
When it comes to project development, there are times when the need is that we 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. This is therefore not possible until Git1.7.0, but fortunately, after Git1.7.0, the sparse checkout mode is added, which makes it possible to specify a file or folder for check out.
The specific implementation is as follows:
$mkdir-F Origin <url>
The code above will help you create an empty local repository and add the remote git Server url to the git config file.
Next, we allow the use of the sparse checkout mode in config:
True
Next you need to tell git which files or folders you really want to check out, and you can save them as a list in the. git/info/sparse-checkout file.
For example:
$echo "Libs" >>. git/Info/sparse-checkout$echo "Apps/register.go" > >. git/info/sparse-checkout$echo "Resource/css" >>. git/Info/ Sparse-checkout
Finally, you just have to pull your project down in the normal way from the branch you want:
$git Pull Origin Master
You can refer to Git's sparse checkout documentation for details: http://schacon.github.io/git/git-read-tree.html#_sparse_checkout
"Go" git How to check out the specified file or folder