git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avery Pennarun <apenwarr@gmail.com>
To: Finn Arne Gangstad <finnag@pvv.org>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH/RFC 1/2] Add 'git subtree' command for tracking history of  subtrees separately.
Date: Thu, 30 Apr 2009 10:32:48 -0400	[thread overview]
Message-ID: <32541b130904300732i691800f5kecc2f845584071c1@mail.gmail.com> (raw)
In-Reply-To: <20090430085853.GA21880@pvv.org>

On Thu, Apr 30, 2009 at 4:58 AM, Finn Arne Gangstad <finnag@pvv.org> wrote:
> On Wed, Apr 29, 2009 at 10:27:44PM -0400, Avery Pennarun wrote:
>> 'git subtree' provides an alternative mechanism, based around the
>> 'git merge -s subtree' merge strategy.  Instead of tracking a submodule
>> separately, you merge its history into your main project, and occasionally
>> extract a new "virtual history" from your mainline that can be easily merged
>> back into the upstream project.  The virtual history can be incrementally
>> expanded as you make more changes to the superproject.
>
> We have the exact same situation. I wanted to attack this from the
> other end though, make submodules useable also in this scenario. The
> subtree solution seems to be much easier to do in git, so maybe this
> is a better approach!

Sounds like your thought process is similar to mine :)  I spent a lot
of time trying to figure out how to convince submodules to work the
way I wanted, until I eventually realized that subtrees were already a
lot closer.

> Let's say you have three different projects that all use some shared
> modules, The following operations should all be easy and fully
> supported:
>
> a) Modify project + some shared modules (in your project) with single commit
> b) Push project + shared modules (for your project)
> c) Push modifications to shared modules
> d) Merge upstream version of shared modules into your project.
>
> My quick analysis:
> Your subtrees: a & b are easy, c & d are painful

My *attempt* with git-subtree was to make all four operations easy.
It's up to you to decide whether I succeeded :)

a) Modify-and-commit: just git commit

b) Push project+shared: just git push

c) Push shared changes only:
      # Should we try to make a simpler single command for this?
      # The problem is: I suspect people will normally want to review the
      # git subtree split output before pushing it anywhere, so combining
      # the split/push operations may not be wise.
      git push shared-remote $(git subtree split --prefix=shared-dir):master

d) Merge upstream changes of shared module:
      git subtree pull --prefix=shared-dir shared-remote master
    or
      git fetch shared-remote master
      git subtree merge --prefix=shared-dir FETCH_HEAD

Have fun,

Avery

  reply	other threads:[~2009-04-30 14:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-26 22:29 [PATCH/RFC 1/2] Add 'git subtree' command for tracking history of subtrees separately Avery Pennarun
2009-04-26 22:29 ` [PATCH/RFC 2/2] Automated test script for 'git subtree' Avery Pennarun
2009-04-30  2:27 ` [PATCH/RFC 1/2] Add 'git subtree' command for tracking history of subtrees separately Avery Pennarun
2009-04-30  3:44   ` Ping Yin
2009-04-30  8:58   ` Finn Arne Gangstad
2009-04-30 14:32     ` Avery Pennarun [this message]
2009-07-16 18:04       ` Andrey Smirnov
2009-07-16 18:34         ` Avery Pennarun
2009-07-16 22:09           ` Andrey Smirnov
2009-07-16 22:27             ` Avery Pennarun
2009-07-17  7:16               ` Andrey Smirnov
2009-07-17 15:47                 ` Avery Pennarun
2009-07-17 17:46                   ` Andrey Smirnov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=32541b130904300732i691800f5kecc2f845584071c1@mail.gmail.com \
    --to=apenwarr@gmail.com \
    --cc=finnag@pvv.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).