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

Re: How-to combine several separate git repos?

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Dec 10, 2007, 01:11 UTC
Message-ID
<Pine.LNX.4.64.0712091942520.5349@iabervon.org>
In-Reply-To
<475C7DD5.9040209@saville.com>
On Sun, 9 Dec 2007, Wink Saville wrote:
Show 23 quoted lines
> Daniel Barkalow wrote:
> > On Sun, 9 Dec 2007, Wink Saville wrote:
> >
> >   I think that submodules do what you want. And they may not be ready for
> > neophytes to just use, but they're ready for neophytes to try using and tell
> > us where things get confused.
> >   
> <snip>
> >  -Daniel
> I would like to try submodules and started to  read the man
> 
> 
> I'll try submodules and I'll start by reading the man page,
> I got to "add" and did the following:
> 
> wink@ic2d1:$ mkdir x
> wink@ic2d1:$ cd x
> wink@ic2d1:$ git init
> Initialized empty Git repository in .git/
> wink@ic2d1:$ git-submodule add ../android/StateMachine
> remote (origin) does not have a url in .git/config
> you must specify a repository to clone.
> Clone of '' into submodule path 'StateMachine' failed

It looks like git-submodule does something really wrong for URLs that start with ./ or ../. (By "wrong", I mean that it's different from the handling of the same URL anywhere else.) I think there's a general problem (beyond submodule support) that git doesn't do a good job with intermediate repositories: if you clone a repository, and then clone the clone, the second clone sees the local-to-the-first aspects and largely ignores the actual origin's properties.

On the other hand, you probably don't really want the canonical URL for the submodule to be a local relative path. If what you have are local clones of public repositories, you want to use the public remote repositories' URLs there. If you really want it to be a clone of the local repository, you can use an absolute path and weird things won't happen.

I think it should be possible to store the submodule data in the 'x' repository as well; have some branches which are the three different projects, and then pull them out of '.', but this doesn't seem to be working for me, either.

Show 16 quoted lines
> The documentation for "submodule add" says:
> 
> /git-submodule/ [--quiet] [-b branch] add <repository> [<path>]
> Add the given repository as a submodule at the given path to the changeset to
> be committed next.
> 
> From the above, <path> is ambiguous to me, is it referring to the source or
> destination. I continue reading and in the options section we find:
> 
> <path>
> 
>    Path to submodule(s). When specified this will restrict the command
>    to only operate on the submodules found at the specified paths.
> 
> So it seems <path> is the for the source, but some how it can specify multiple
> paths.

This is actually the destination. The projects that are under discussion are only submodules in the context of the destination. For "git submodule add" it's the path in the superproject where the submodule will appear.

	-Daniel
*This .sig left intentionally blank*
Previous: Wink SavilleNext: Wink Saville
Message 6 of 13 in “How-to combine several separate git repos?”
  1. Wink SavilleDec 9, 2007
  2. Alex RiesenDec 9, 2007
  3. Wink SavilleDec 9, 2007
  4. Daniel BarkalowDec 9, 2007
  5. Wink SavilleDec 9, 2007
  6. Daniel BarkalowDec 10, 2007
  7. Wink SavilleDec 10, 2007
  8. Daniel BarkalowDec 10, 2007
  9. Wink SavilleDec 10, 2007
  10. Daniel BarkalowDec 10, 2007
  11. Wink SavilleDec 10, 2007
  12. Alex RiesenDec 10, 2007
  13. Wink SavilleDec 10, 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.