2

How can I merge this submodule after having had the following warning?

warning: Failed to merge submodule sites/all/modules/contrib/panelizer 
                (not checked out)
Mat
  • 202,337
  • 40
  • 393
  • 406
Sam3k
  • 960
  • 1
  • 11
  • 22
  • 1
    ...is the submodule checked out? (Did you ever run `git submodule update`?) Submodules are Git repositories within the main repository; they must be cloned into it and updated when necessary - `git submodule update` is the command which does this. If there aren't files in that directory, it's not checked out. – Cascabel Jan 12 '12 at 19:40

1 Answers1

1

That error message comes from submodule.c, specifically the merge_submodule() method:

int merge_submodule(unsigned char result[20], const char *path,
                    const unsigned char base[20], const unsigned char a[20],
                    const unsigned char b[20], int search)
{
  struct commit *commit_base, *commit_a, *commit_b;
  int parent_count;
  struct object_array merges;

  // [...]

  if (add_submodule_odb(path)) {
    MERGE_WARNING(path, "not checked out");
    return 0;
  }

And the add_submodule_odb() method is checking for .git presence within said submodule.

So, as Jefromi comments, you probably didn't do a git submodule update as described in the Pro Git book.
You should see the SO question "Git - easy way pull latest of all submodules" for more on how to get back the content of all your submodules.

With a recent git, you can pull and update in one go:

git alias update_submodules='git pull --recurse-submodules && git submodule update' 
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks for the detailed response VonC; and thank you very much for that alias gem. I will switch to using that. – Sam3k Jan 14 '12 at 02:25