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

Re: "git submodule" vs "git subtree" vs "repo" vs "git subdir" ... ?

From
Stefan Beller <sbeller@google.com>
Date
Feb 13, 2018, 18:25 UTC
Message-ID
<CAGZ79kYubKmmpg_aka=P0FMjQSqrYQaerq3=awwGRfW_H8H+Vg@mail.gmail.com>
In-Reply-To
<alpine.LFD.2.21.1802130746360.16738@localhost.localdomain>
On Tue, Feb 13, 2018 at 5:06 AM, Robert P. J. Day <rpjday@crashcourse.ca> wrote:
Show 20 quoted lines
>
>   looking for general opinions ... i am (frighteningly :-) teaching a
> git course later this week, and one of the topics on the list is git
> submodules, which was specifically requested by the client as their
> idea of how to start incorporating child repos in new projects.
>
>   however, given the number of articles written about the drawbacks
> with submodules, i wanted to throw in a section about "git subtree" as
> well, even though (as discussed earlier) there is some minor dispute
> as to whether "git subtree" is part of "core" git, but i'm not going
> to let that stop me.
>
>   going even beyond that, there is also google's "repo" command, which
> i seem to see more and more often, like here for automotive grade
> linux:
>
>   https://wiki.automotivelinux.org/agl-distro/source-code
>
> and it would be a shame to at least not mention that as yet another
> possibility.

Please note that Google would prefer to get rid of the repo tool. (It was made as a stop gap solution until submodules are good enough, i.e. have comparable UX compared to repo. But as you know stop gap solutions hold up for quite a long time reliably. :) repo has issues by itself, fundamental issues such as the data model, as well as minor things like complete lack of tests)

Show 9 quoted lines
>   and then there are unofficial, hand-rolled solutions, like
> "git-subdir":
>
>   https://github.com/andreyvit/git-subdir
>
> given that the client does not appear to be wedded to any particular
> solution yet, i'm open to recommendations or pointers to online
> comparisons that i'll collect and post on a single wiki page, and they
> can peruse the comparisons at their leisure.

There are a couple of these. I came across these recently http://gitslave.sourceforge.net/ https://github.com/ingydotnet/git-subrepo

Show 8 quoted lines
>   so ... thoughts? no need to be verbose, just links to decent online
> discussions/comparisons would be massively useful.
>
> rday
>
> p.s. oh, pointers to well-designed usage of any of the above would be
> handy as well. as i mentioned, for "repo", there's AGL. for
> submodules, i might use boost:

If your copy of Git is recent, look at the man pages for submodules such as d48034551a (submodules: overhaul documentation, 2017-06-22) or 4f73a7f124 (Doc/gitsubmodules: make some changes to improve readability and syntax, 2018-01-14)

>   https://github.com/boostorg/boost/wiki/Getting-Started
>
> and so on. thank you kindly.
Stefan
Previous: Nicolas Morey-Chaisemartin
Message 3 of 3 in “"git submodule" vs "git subtree" vs "repo" vs "git subdir" ... ?”
  1. Robert P. J. DayFeb 13, 2018
  2. Nicolas Morey-ChaisemartinFeb 13, 2018
  3. Stefan BellerFeb 13, 2018

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.