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

Re: organizing multiple repositories with dependencies

From
SRSeth Robertson <in-gitvger@baka.org>
Date
Apr 24, 2012, 17:59 UTC
Message-ID
<201204241759.q3OHxSbH017287@no.baka.org>
In-Reply-To
<nngbomh3uz0.fsf@transit.us.cray.com>
In message <nngbomh3uz0.fsf@transit.us.cray.com>, dag@cray.com writes:
    > I agree and am willing to provide information about submodule use cases,
    > advantages and problems, but I'm not a user of subtree so I can't really
    > comment on it. Now that subtree is in git core, what about putting such
    > a comparison under Documentation/subproject-support.txt?
    That would be great.  Do you want to start work on that?  I can
    contribute some text about git-subtree.

I have a document I created for gitslave which I have cleaned up a bit and might be the start of such comparison.

---------------------------------------------------------------------- git-submodules is the legacy solution for putting repositories inside of other repositories. With git submodules, the submodule is checked out to a semi-fixed commit, typically on a detached HEAD. To make a change to the subproject, you need to check the submodule repository out onto the correct branch, make the desired change (possibly involving pull), commit, and then go into the superproject and commit the commit (or at least record the new location of the submodule). It was designed for third party projects which you typically do not doing active development on. Many/most git commands performed on the superproject will not recurse down into the submodules. submodules give you a tight mapping between subproject commits and superproject commits (you always know which commit a subproject was in for any given superproject commit). git-submodules is considered difficult to use for less experienced git developers who need to modify the subproject.

Another option is to stick everything in one giant repository, typically by using git-subtree. This might make your repository large and you have to manually run git-subtree commands to export your changes back out to the individual non-aggregated repositories. All git commands run as normal, though when examining pre-subtree history, you can see the individual lines of development on different branches.

gitslave creates a federation of git repositories—a superproject repository and a number of slave repositories—all of which may be concurrently developed on and on which all desired git operations will touch. In a typical use case, you would branch all repositories (to the same branch name) at the same time, and checkout or tag or get of the status of all repositories at the same time. For essentially any git command, you simply replace "git" with "gits" to get the specified git command to run on all repositories. Of course, some commands do not necessarily make a great deal of sense to run over all git repositories (eg. `git add filename`), but you are allowed to run any normal git command on any of the repositories at any time. gitslave provides a loose binding so that it is not necessarily completely clear which revision one repositories was at when a commit was made in a different repository, except after tag operations.

Another options include repo from Google, used with Android. Repo seems to work much like gitslave from a high level perspective, but there isn't a lot of documentation on using it for other projects.

Still another option is kitenet's mr which supports multiple repository types (CVS, SVN, git, etc). It is absolutely the solution for multi-SCM projects, but since it works on the lowest common denominator you would lose much of the expressive power of git.

The final option is to just put git repositories inside of other repositories. However, you must be sure to add the subproject into the superproject's .gitignore to prevent `git add` from adding the subproject as a broken submodule commit (broken because no .gitmodules or git-config entry will exist for it). ----------------------------------------------------------------------

					-Seth Robertson
Previous: dag@cray.comNext: Jens Lehmann
Message 23 of 34 in “organizing multiple repositories with dependencies”
  1. Namit BhallaApr 16, 2012
  2. Jakub NarebskiApr 16, 2012
  3. dag@cray.comApr 16, 2012
  4. Hilco WijbengaApr 17, 2012
  5. dag@cray.comApr 17, 2012
  6. Seth RobertsonApr 17, 2012
  7. Hilco WijbengaApr 17, 2012
  8. dag@cray.comApr 17, 2012
  9. Hilco WijbengaApr 17, 2012
  10. PJ WeisbergApr 17, 2012
  11. Hilco WijbengaApr 17, 2012
  12. Namit BhallaApr 18, 2012
  13. Jens LehmannApr 18, 2012
  14. dag@cray.comApr 24, 2012
  15. Hilco WijbengaApr 24, 2012
  16. PJ WeisbergApr 24, 2012
  17. Hilco WijbengaApr 24, 2012
  18. dag@cray.comApr 24, 2012
  19. Phil HordApr 30, 2012
  20. dag@cray.comApr 30, 2012
  21. Jens LehmannApr 18, 2012
  22. dag@cray.comApr 24, 2012
  23. Seth RobertsonApr 24, 2012
  24. Jens LehmannApr 24, 2012
  25. Seth RobertsonApr 24, 2012
  26. dag@cray.comApr 24, 2012
  27. username localhostApr 28, 2012
  28. dag@cray.comApr 24, 2012
  29. Seth RobertsonApr 25, 2012
  30. dag@cray.comApr 27, 2012
  31. Eugene SajineApr 24, 2012
  32. Hilco WijbengaApr 24, 2012
  33. dag@cray.comApr 24, 2012
  34. dag@cray.comApr 24, 2012

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.