I know it's possible to have shallow submodules using the --depth
option with git submodule update
.
However, If I run
git submodule update --init --recursive --depth 1
on my project with several submodules, I get a fatal: reference is not a tree
. So I've tried again with
git submodule update --init --recursive --depth 100
which worked correctly, however I'd like to keep depth at 1.
It seems to me that --depth 1
pulls the latest commit in the submodule, not the commit pointed by the main repository, and that's why setting it to 100 solved the problem, since it pulled a longer list of commits, including the pointed ones.
Unfortunately, if that's the case then I cannot generally be sure the latest 100 commits include the one I need.
How do I tell git to use the pointed commits and not the latest ones in the shallow clone with submodules?
I'm using git 1.9.4 on Windows.
git config -f .gitmodules submodule.<name>.shallow true
with https://mcmap.net/q/13855/-git-submodule-without-extra-weight – Opiate