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

git submodule support feedback

From
APAndy Parkins <andyparkins@gmail.com>
Date
Apr 26, 2007, 11:38 UTC
Message-ID
<200704261238.51234.andyparkins@gmail.com>
Hello,

I've started using submodule support in one of my projects. I was previously using my own poorman's submodule support where I kept the commit in a file, .gitmodules. Git's new submodule support is superior to this method and doesn't lose me any features over what I had so I thought I'd change.

My general comment is that it's great. I've tried to trip it up a few times, but it works exactly as one would expect. I was surprised how little I had to understand in order to make it work, I didn't even need git update-index. git-add and git-rm work fine when the directory you're adding is a git repository in itself. Lovely.

I'll report further as I come across any stumbling blocks; but here is one to get you going: (It's not a problem with git really, and the workaround is simple, I'm reporting it for your information rather than to get it fixed).

In the master branch I deleted my .gitmodules file and did
 
 $ git add submodule
 $ git commit -m "Chuck poorman's-submodule use gitman's-submodule"

This took over the submodule management beautifully. Now, I swapped to another branch and tried to merge the master branch:

 $ git checkout somebranch
 $ git merge master
 fatal: Updating 'submodule' would lose untracked files in it
 Merge with strategy recursive failed.

I appreciate why this has happened - submodule, from the point of view of git - doesn't exist in that branch, but the directory always has, as that's where I've kept it as my pseudo-submodule. The fix was to do

 $ mv submodule submodule.tmp
 $ git merge master
 $ rmdir submodule
 $ mv submodule.tmp submodule

I bring this up only because anyone who's moving from non-submodule to submodule support might run into the same problem.

In short: great stuff - this is already more facility than I had, thanks chaps.

Andy
-- 
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com
Next: Marco Costalba
Message 1 of 7 in “git submodule support feedback”
  1. Andy ParkinsApr 26, 2007
  2. Marco CostalbaApr 26, 2007
  3. Andy ParkinsApr 26, 2007
  4. Andy ParkinsApr 26, 2007
  5. David LangApr 26, 2007
  6. Junio C HamanoApr 26, 2007
  7. Andy ParkinsApr 26, 2007

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.