<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 12, 2013 at 6:14 PM, Nystrom, William D <span dir="ltr"><<a href="mailto:wdn@lanl.gov" target="_blank">wdn@lanl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":3rc">I have a git project that I call petsc_dev that contains my scripts and infrastructure for<br>
building various flavors of petsc-dev i.e. with various packages including supported<br>
external packages.  Within my petsc_dev git repo, I'd like to keep a clone of the<br>
petsc git repo.  I'd like to be able to periodically update this petsc repo from the<br>
official petsc repo.  I'd also like to maintain personal branches in my clone of the<br>
petsc repo.  Finally, when I clone my top level project, petsc_dev, I'd like it to include<br>
the petsc clone.<br>
<br>
Is git submodules the way to go with this?  I'm reading Ch 15 of Loeliger's book which<br>
discusses combining projects within git.  He said that git submodules were not that<br>
great at the time he wrote the book in 2009.  But that was 3-4 years ago.  Are git<br>
submodules improved enough at this time to be the right way to go with what I want<br>
to do or should I use one of the hacks that Loeliger suggests in his book?</div></blockquote></div><br>I second Mark's suggestion to look at <a href="http://git-scm.com/book">git-scm.com/book</a>, but I would not recommend git subtree for your workflow. They are intended for different things:</div>
<div class="gmail_extra"><br></div><div class="gmail_extra" style>subtree:</div><div class="gmail_extra" style>  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).</div>
<div class="gmail_extra" style><br></div><div class="gmail_extra" style>submodule:</div><div class="gmail_extra" style>  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.</div>
<div class="gmail_extra" style><br></div><div class="gmail_extra" style><br></div><div class="gmail_extra" style>Subtree is newer, but I think submodule is formally better for your use case, but you can try both.</div></div>