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

Re: Project- vs. Package-Level Branching in Git

From
Iin-gitvger@baka.org <in-gitvger@baka.org>
Date
Jan 28, 2011, 16:39 UTC
Message-ID
<201101281639.p0SGdZe1006900@no.baka.org>
In-Reply-To
<15B7CA2E-C584-4563-B9E3-D80861CD9565@shaggyfrog.com>

In message <15B7CA2E-C584-4563-B9E3-D80861CD9565@shaggyfrog.com>, Thomas Hauk w rites:

    On Jan 27, 2011, at 12:53 PM, Ævar Arnfjörð Bjarmason wrote:
    > You'll be much better off if you have project-specific repositories.
    But how often do you have a project that has no external or
    internal dependencies on any other packages or libraries? Any
    project I've ever done, big or small, has relied on some existing
    codebase. Imagine a project that uses liba and libb, which both
    reference libc. To use Git, I'd have to have copies of libc
    existing in three repositories, and copies of liba and lib in two
    repositories each. What a nightmare... and that's only a trivial
    hypothetical example.

Including libs in the superproject is the subtree merge method. It certainly works and provides inband commit exploration (since one repo can see all commits), but it inconvenient to update and even harder to export changes back to share with other liba users. It may also cause the repo to be inconveniently large. Arranging for the correct commits to be on the differently named branches (between the subproject and the superproject) is also not convenient.

git-submodule is the normal approach for the problem you have. There is a strong binding from each commit in the superproject to commits in the subprojects. What is inconvenient is managing what branch you need to check out on the subproject in order to get or make the right changes in the right place. It is also annoying if you are performing active development on the subprojects since you continually have to update the superproject and then recheckout the correct branches on the subproject.

Another solution is gitslave (http://gitslave.sf.net). This provides a loose binding from the superproject to the subprojects which is very convenient if you are doing active development on all of the subprojects. Specifically there is only a strong binding when you tag (since you tag the superproject and all subprojects at the same time). Generally, however, you check out the same branch/tag on all branches at the same time, which obviously does not match your preferred usage, except it gave me an idea. Specifically, you could have your own local master bare repositories for those packages and an orthogonal naming scheme for branches and tags. So the project foo would might have branch foo-2.0 and liba libb and libc would all have those branches as well. When you want to update libb, a repo with the true master upstream and the local master upstream would fetch the true master and merge the changes from the correct branch into foo-2.0 and then push to the local upstream master. Everyone else would then just `gits pull` and would get the changes.

Of course this concept for a local master would work for submodules as well, depending on whether you want the tight binding and update/change annoyance or the loose binding and easier update/changes.

					-Seth Robertson
Previous: Marc BranchaudNext: Eugene Sajine
Message 13 of 16 in “Project- vs. Package-Level Branching in Git”
  1. Thomas HaukJan 27, 2011
  2. Andreas EricssonJan 27, 2011
  3. Ævar Arnfjörð BjarmasonJan 27, 2011
  4. Thomas HaukJan 27, 2011
  5. Jay SoffianJan 28, 2011
  6. Jakub NarebskiJan 28, 2011
  7. Enrico WeigeltJan 29, 2011
  8. David AguilarJan 29, 2011
  9. Enrico WeigeltJan 30, 2011
  10. Jakub NarebskiJan 31, 2011
  11. Enrico WeigeltJan 31, 2011
  12. Marc BranchaudJan 28, 2011
  13. in-gitvger@baka.orgJan 28, 2011
  14. Eugene SajineJan 28, 2011
  15. Enrico WeigeltJan 29, 2011
  16. Enrico WeigeltJan 29, 2011

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.