git subtrees [was Re: Panorama module for G3]

Mike Miller <[email protected]> Tue, 15 Jan 2013 13:02:25 +0200
Newsgroups gmane.comp.web.gallery.devel
Message-ID <CAGYq59d3UY=WiEbvyMjSOSKTCFX=w8sZLQNaytFySHfYKqSxqQ@mail.gmail.com>
On Tue, Jan 15, 2013 at 8:42 AM, Mike Miller <[email protected]> wrote:
> On Mon, Jan 14, 2013 at 10:43 PM, Bharat Mediratta <[email protected]> wrote:
>> You can probably do some git magic to keep the two in sync, but my git fu is
>> not good enough to tell you offhand.  Or you can just copy stuff over and
>> submit pull requests every once in a while.
>
> There're few better motivators than being told by someone with more
> experience that they don't know something :)
>
> The key appears to be subtrees; here's what I did (within my fork of
> gallery3-contrib):
>
> git remote add -f panorama git-9UaJU3cA/F/[email protected]:mikeage/panorama.git
> git merge  --squash -s ours --no-commit  panorama/master # The initial
> commit should squash all of my development into one commit
> git read-tree --prefix 3.0/modules/panorama -u panorama/master
> git commit -m "Add panorama as a subtree"
>
> Subsequent development that I do in my repository can be taken into my fork via:
>
> git pull -s subtree --squash  panorama master # Or without --squash;
> then the default is to commit unless --no-commit is specified
>
> It's not yet clear to me how I would merge a change that someone makes
> in gallery3-contrib to my repo, but that's my problem, not yours :)

I looked into this a bit more, and it seems like this is not the best
solution, since pushing is rather tricky. Instead, I installed the
contrib "subtree" module (included as of git 1.7.11), and this seems
to do exactly what I want. I removed what I had above, and then ran
the following

git subtree add --prefix=3.0/modules/panorama
git-9UaJU3cA/F/[email protected]:mikeage/panorama.git master --squash

Updating the code in gallery3-contrib is done with:

git subtree pull --prefix 3.0/modules/panorama panorama master OR
git subtree pull --prefix 3.0/modules/panorama panorama master --squash

And delivering changes to my repository can be done with:

git subtree push --prefix 3.0/modules/panorama panorama master [--squash]

Hopefully this will help someone else as well.

-- Mike

------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
__[ g a l l e r y - d e v e l ]_________________________

[ list info/archive --> http://gallery.sf.net/lists.php ]
[ gallery info/FAQ/download --> http://gallery.sf.net ]