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

Re: subrepo vs submodule

From
Stefan Beller <sbeller@google.com>
Date
Jul 19, 2017, 17:43 UTC
Message-ID
<CAGZ79kas6jm8+1BhhHqOe4PzFObLVEASXEQfV0H9j=4oLvz7Lw@mail.gmail.com>
In-Reply-To
<CAHd499BovefnyWjauE0vNaofmvL8JBZCSzJ7w-cJ8Sm3eoJ4=w@mail.gmail.com>
On Wed, Jul 19, 2017 at 7:27 AM, Robert Dailey <rcdailey.lists@gmail.com> wrote:
> So I found out about "subrepo" today: https://github.com/ingydotnet/git-subrepo
>
> I'm still reading about how it works internally, but what do you guys
> think about it?
Nice find!

From reading the toplevel ReadMe.pod, I have the impression that it is closer to subtree than submodules as the content is stored in the main repository using a .gitrepo file to indicate that it is a special directory.

> Is it a more or less perfect alternative to submodules?
Maybe to subtrees. It does not offer the workflows that
submodules allow you:
  " Users get your repo and all your subrepos just
  by cloning your repo."
Submodules allow you to *not* get the content of a submodule.
There are multiple reasons for not wanting the content, including
* not needing it (e.g. documentation, hardware specific code
  for an architecture you don't have)
* not wanting it (e.g. large binary files yield bandwidth concerns)
"Upstream history (clone/pull) is condensed into a single commit."
Same for submodules, not so(?) for subtrees.

Depending on the point of view this is either a feature or a bug. For clean history you may view this as a feature, but as soon as you want to git-bisect, you'd wish for the most fine grained history available.

> What would be a reason not to use it?
There are multiple things that should drive a decision. some:
* What do you need in terms of workflow (even just talking about
  "submodule vs subtree" you get different answers for different
  workflows), and then seeing how subrepo compares to the others.
* Can you use it? (does it work on your platform? subrepo is bash,
  whereas submodule, subtree are posix shell; how is it distributed?
  Some people are uneasy installing from random github repos on
  the web, so do you install it via the package manager of your
  distribution, has your organisation a package to use?)
* Ease of use, do you need to explain the workflow
  to collaborateurs?
Previous: Robert Dailey
Message 2 of 2 in “subrepo vs submodule”
  1. Robert DaileyJul 19, 2017
  2. Stefan BellerJul 19, 2017

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.