Reputation: 81
I've a large repository with disk space of around 5Gb. I only need few folders from this repository and I'm able to do sparse checkout for those folders. But the diskspace consumption of .git folder is still 5GB. So, is there any way to save disk space and only clone the required folders or any other way?
Steps for my sparse checkout:
git init
git config core.sparsecheckout true
touch .git/info/sparse-checkout
echo path/to/folder1 >> .git/info/sparse-checkout
echo path/to/folder2 >> .git/info/sparse-checkout
git remote add -f <branch name> <url> <==taking too much memory here
git checkout <tag>
Upvotes: 4
Views: 2736
Reputation: 1323203
The only other way (beside trying to trim down the .git size with aggressive git gc
) would be to:
That way, you are dealing with an intermediate repo which contains only the history of that branch with the folders you are interested in.
Yet, an integrator can clone the main repo, fetch the second repo (the one with only one branch) and reintegrate back any modification you would have published on the second repo.
Upvotes: 1