I'm not a Git master yet, faced a problem I can't figure out how to fix. I have a repo with my WordPress custom skeleton and I've added WordPress as a submodule from its original repo by git submodule add wp_repo_url
. When I clone my repo to local machine with:
git clone --recursive https://github.com/user/repo local_dir
it downloads the WP submodule as expected, but here's the problem - actual files are only 20.7Mb, and in .git/modules/core/objects/pack
I've got a huge 124Mb .pack file, which, I suppose, is smth like commit history / revisions of that submodule.
How can I re-add submodule or modify while cloning to prevent downloading this extra weight?
UPDATE:
With the help of @iclmam I've came up with the following setup:
- my skeleton repo will have WordPress as a submodule, the whole original repo with history
- when creating a new project from skeleton, I'll clone it without --recursive option to get only the main files and empty folder for submodule
- IF I need WordPress with full history - for example, if I need to switch between different WP branches/tags to test my plugin/theme backward compatibility - then I'll get this submodule with full history
if I just need a plain clean install of recent WP version, I'll change into wp directory and go the old way:
curl -L -O http://wordpress.org/latest.zip unzip latest.zip mv wordpress/* . rm latest.zip rm -rf wordpress
Not a perfect solution (I wanted to automate everything as much as possible), but it works for now.
Any advices on the original question are appreciated.
git config -f .gitmodules submodule.<name>.shallow true
: See my answer below – Camus