Fix checking out recursive git submodules

When nested submodules appear in a git repository, the `git submodule foreach
git checkout-index ..` command would fail because it would checkout at the root
directory instead of in its parent(s)' folder.

Eg: root/submodule1/submodule2 would be checked out in root/submodule2