4 ms·
> In Git, you can checkout neither a single folder nor a file. Yes, you can. It's called sparse checkout[1] and not that hard. Also, you can subtree merge[2][3
by Walkman 12y ago
> In Git, you can checkout neither a single folder nor a file.
Yes, you can. It's called sparse checkout[1] and not that hard.
Also, you can subtree merge[2][3] directories back and forth preserving all the history and merging back if you wish (cutting a directory out of the repository to a separate one and putting it back). It's pretty easy to do in git>2.0 because there is a builtin subtree command[4] for it.
[1]: https://www.kernel.org/pub/software/scm/git/docs/git-read-tree.html#_sparse_checkout https://www.kernel.org/pub/software/scm/git/docs/git-read-tr...
[2]: https://help.github.com/articles/about-git-subtree-merges https://help.github.com/articles/about-git-subtree-merges
[3]: http://git-scm.com/book/en/Git-Tools-Subtree-Merging http://git-scm.com/book/en/Git-Tools-Subtree-Merging
[4]: https://news.ycombinator.com/item?id=3926683 https://news.ycombinator.com/item?id=3926683
- manojlds 12y agoThe actual meaning here is "clone" a single folder or file, not checkout.
- Walkman 12y agoThere is no practical difference. Yes, you clone and have the whole repository on the disk, but after a sparse checkout you only have to deal with the files you are interested in. The only problem can be with Facebook-sized repositories, but I believe in modularizing that big of a system instead of storing everything in one vast repository.