Reputation: 90475
Our .git/objects/pack directory is quite big and I would like to have a sparse checkout with the least possible disk space consumed.
Is it possible to make a sparse checkout and avoid having this directory and all its contents?
Upvotes: 3
Views: 508
Reputation: 14843
Your question doesn't make a lot of sense as written. You are talking about the size of the objects pack file being large (which is a case of the repository history being big), but then you are talking about sparse checkout - which has to do with working directory space, and not repository space. You can have massive repository objects but a tiny working directory.
The git clone --depth
answer already provided covers repository.
If you really want to do something goofy with your checkout operation I would try the following three commands
git read-tree --reset
git read-tree HEAD:<path to folder you are interested in>
git checkout-index
This should get you just a single directory in your working directory. You wouldn't be able to make a (useful) commit though, you'd have to manually create tree objects and manually create commits.
Upvotes: 2
Reputation: 3315
git clone --depth
Note: Shallow clones can't be used for Pushing anything as you will get Fast-Forward error
Upvotes: 0