I'm trying to add an external repo as a submodule of my repo, so I followed these instructions, doing:
git submodule add git:... vendor
git submodule init
git submodule update
then I tired:
git submodule init vendor
git submodule update vendor
The submodule that I'm adding has submodules, and the submodule's submodules appear to to be checkedout (ie: I see the files on my hard drive) but the files for the submodule itself are not checkout out.
Any idea what I'm doing wrong?
This is the repo that I'm trying to add as a submodule, and it's src
directory is all that I see in my checkout/clone, along with the sub directories and files or src
, but I don't have the readme file for example.
A git submodule is a record within a host git repository that points to a specific commit in another external repository. Submodules are very static and only track specific commits. Submodules do not track git refs or branches and are not automatically updated when the host repository is updated.
If you already cloned the project and forgot --recurse-submodules , you can combine the git submodule init and git submodule update steps by running git submodule update --init . To also initialize, fetch and checkout any nested submodules, you can use the foolproof git submodule update --init --recursive .
The . gitmodules file, located in the top-level directory of a Git working tree, is a text file with a syntax matching the requirements of git-config[1].
Since git version 1.6.5 you can use the --recursive
and --init
options to git submodule update
to make sure that submodules are recursively initialized and updated. So, for your example, the following works for me:
$ git submodule add git://github.com/jbalogh/zamboni-lib.git vendor
remote: Counting objects: 7001, done.
remote: Compressing objects: 100% (5985/5985), done.
remote: Total 7001 (delta 1137), reused 6337 (delta 736)
Receiving objects: 100% (7001/7001), 14.88 MiB | 1.99 MiB/s, done.
Resolving deltas: 100% (1137/1137), done.
$ git submodule update --init --recursive
[... lots of output ...]
I hope that's of some use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With