git/list[1] front-page[2] threads[3] people[4] search[5] about
 

submodules

From
SWshawn wilson <ag4ve.us@gmail.com>
Date
Jan 23, 2014, 08:38 UTC
Message-ID
<CAH_OBicG4bLWu_C=uF6bTzzdJP5SSZ=odQF-qsP4n+VvAN4nrQ@mail.gmail.com>

I've got a git repo that just contains a bunch of small projects (scripts, configs, etc). The idea was (is) to make it so that each project is tracked seperately (different branches, not needing to filter out logs for unrelated commits). And it works great for that. The problem is that I guess I don't know how to manage it and keep stumbling and tripping over myself here.

My issue is in trying to update the submodules, I'm getting:
 % git submodule update --init
                                                gits/kt (master ⚡)
swlap1
fatal: reference is not a tree: 98f1e9f99fca32ab3de901219eb2f600d38ab3a5
Unable to checkout '98f1e9f99fca32ab3de901219eb2f600d38ab3a5' in
submodule path 'repo_a'

Ok, so a bit of googling and I found this: http://stackoverflow.com/questions/13425298/git-submodule-update-fatal-error-reference-is-not-a-tree Ok, so update the repo that contains the submodules every time you push from a sub repo? How / where do I create a hook to do this?

And then:
http://stackoverflow.com/questions/2155887/git-submodule-head-reference-is-not-a-tree-error
So, the first example didn't really work:
 % cd repo_a
                                            gits/kt (master ⚡) swlap1
 % git checkout 98f1e9
                                              kt/repo_a (master)
swlap1
error: pathspec '98f1e9' did not match any file(s) known to git.
So, at this point I realized I have pushed from two repos (maybe
others have as well) and not updated the repo of submodules. So, as
long as the issue is just with this one repo, I'm ok with loosing a
little data (not much has changed in a while and maybe I'll go and
find the blobs and merge them back in later). So I try the other
method:
 % git log --oneline -p -- repo_a
                                            gits/kt (master ⚡) swlap1
7911a1e Bump.
diff --git a/repo_a b/repo_a
index 206635e..98f1e9f 160000
--- a/repo_a
+++ b/repo_a
@@ -1 +1 @@
-Subproject commit 206635eed8b94e4133a7689b34a570e2fb0b6069
.......
 % git checkout d92f592- -- repo_a
                                            gits/kt (master ⚡) swlap1
fatal: invalid reference: d92f592-



So, (after this is solved) is there a post hook (not even sure where
such a thing would go) after pushing from a submodule repo (maybe a
concatination of commit messages or something) so that this stays in
sync and I never have to think about this again (though I think I'll
remember after winning this fight).
Next: W. Trevor King
Message 1 of 2 in “submodules”
  1. shawn wilsonJan 23, 2014
  2. W. Trevor KingJan 23, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.