[petsc-dev] git submodules

Jed Brown jedbrown at mcs.anl.gov
Tue Mar 12 18:39:06 CDT 2013


On Tue, Mar 12, 2013 at 6:14 PM, Nystrom, William D <wdn at lanl.gov> wrote:

> I have a git project that I call petsc_dev that contains my scripts and
> infrastructure for
> building various flavors of petsc-dev i.e. with various packages including
> supported
> external packages.  Within my petsc_dev git repo, I'd like to keep a clone
> of the
> petsc git repo.  I'd like to be able to periodically update this petsc
> repo from the
> official petsc repo.  I'd also like to maintain personal branches in my
> clone of the
> petsc repo.  Finally, when I clone my top level project, petsc_dev, I'd
> like it to include
> the petsc clone.
>
> Is git submodules the way to go with this?  I'm reading Ch 15 of
> Loeliger's book which
> discusses combining projects within git.  He said that git submodules were
> not that
> great at the time he wrote the book in 2009.  But that was 3-4 years ago.
>  Are git
> submodules improved enough at this time to be the right way to go with
> what I want
> to do or should I use one of the hacks that Loeliger suggests in his book?
>

I second Mark's suggestion to look at git-scm.com/book, but I would not
recommend git subtree for your workflow. They are intended for different
things:

subtree:
  Parent repo P is a significant (or even sole) contributor to the subrepo
S. You want to be able to branch and merge parent repo easily, resolving
transitive conflicts as if P was a monolithic repository (containing the
contents of S). Patches affecting S are regularly sent upstream via pull
requests. P has no meaning without S (and it is impossible to clone P
without also cloning S).

submodule:
  S is an independent repository with its own development team and its own
test suite and release model. Changes to S are developed on their own,
mostly independently of P. You want to somehow put S inside P to make
cloning simpler and to make sure that versions match up. VTK is a submodule
in Paraview, for example.


Subtree is newer, but I think submodule is formally better for your use
case, but you can try both.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20130312/37879252/attachment.html>


More information about the petsc-dev mailing list