Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Submodule's files are not checked out

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.

like image 941
erikvold Avatar asked Oct 15 '10 02:10

erikvold


People also ask

How do submodules work in git?

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.

How do I initialize a git submodule?

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 .

Where is the .gitmodule file?

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].


1 Answers

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.

like image 87
Mark Longair Avatar answered Sep 18 '22 07:09

Mark Longair