Skip to content

Instantly share code, notes, and snippets.

@nowox
Created August 15, 2017 09:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nowox/4d7c055c3b892ab46e4cf76aac2653ec to your computer and use it in GitHub Desktop.
Save nowox/4d7c055c3b892ab46e4cf76aac2653ec to your computer and use it in GitHub Desktop.
~ $ cd test
~/test $ git init
git clone --depth=1 --no-checkout ../sub sub
git submodule add ../sub sub
git submodule absorbgitdirs
# note there is no "submodule.sub.sparsecheckout" key
git -C sub config core.sparseCheckout true
echo bar >>.git/modules/sub/info/sparse-checkout
git submodule update subInitialized empty Git repository in /cygdrive/c/Users/Ycr/Home/ppp/test/.git/
~/test $ # I did not find a way to add submodule in 1 step without checking out
~/test $ git clone --depth=1 --no-checkout ../sub sub
Cloning into 'sub'...
warning: --depth is ignored in local clones; use file:// instead.
done.
~/test $ git submodule add ../sub sub
Adding existing repo at 'sub' to the index
~/test $ git submodule absorbgitdirs
Migrating git directory of 'sub' from
'/cygdrive/c/Users/Ycr/Home/ppp/test/sub/.git' to
'/cygdrive/c/Users/Ycr/Home/ppp/test/.git/modules/sub'
~/test $ # note there is no "submodule.sub.sparsecheckout" key
~/test $ git -C sub config core.sparseCheckout true
~/test $ echo bar >>.git/modules/sub/info/sparse-checkout
~/test $ git submodule update sub
~/test $ tree
.
└── sub
1 directory, 0 files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment