From: Erick Mattos <erick.mattos@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v2] git checkout -b: unparent the new branch with -o
Date: Sun, 14 Mar 2010 18:57:22 -0300 [thread overview]
Message-ID: <55bacdd31003141457t7d2cebe3u9854d3c0a55b7da0@mail.gmail.com> (raw)
In-Reply-To: <7v4okkegdy.fsf@alter.siamese.dyndns.org>
Hi
As I see you have found a very good example under your common work
flow. Nice. :-)
Regards
2010/3/13 Junio C Hamano <gitster@pobox.com>:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> As I already said, I do not think "mostly common paths" case should be
>> encouraged to begin with. As far as I know (and you can guess by now that
>> I know reasonably well about git), you do not gain anything by not having
>> the ancestry link between '?' and 'B', except that it would make conflict
>> resolution at '*' extremely difficult. There is only downside without any
>> upside in "mostly common paths" disjoint merge.
>
> There is one case "mostly common paths" disjoint history can be useful.
>
> Imagine you have a hitherto proprietary software project and want to go
> open source. Perhaps your intention is to have an open source version and
> an enhanced commercial version. The project contains some third-party
> vendor software outside your control, and you have replaced them with open
> source equivalents or disabled features that depend on them.
>
> Your history may look like this:
>
> o---o---A oss-base
> /
> ---o---o---o---o master
>
> where master is the primary version you will continue shipping to your
> paying customers, with proprietary third-party components and features
> that depend on them. Commits on oss-base were your work to prepare the
> tree into a releasable shape, removing these proprietary stuff along with
> some features.
>
> But you cannot publish oss-base (commit A) to the public. "git log" will
> show all the history that leads to it, with all the third-party stuff you
> do not have license to distribute in the source form. The older parts of
> the history may even have site password at customer installation you have
> committed by mistake and eradicated long time ago.
>
> If you run this three command sequence (in this message, I am assuming
> that you keep the index and the working tree files intact in an updated
> implementation of --orphan, which is different from the suggestion to
> support "no common paths" case I mentioned in the previous message):
>
> $ git checkout --orphan oss oss-base
> $ git checkout oss-base
> $ git merge -s ours oss
>
> you will get a history of this shape:
>
> X oss
> \
> o---o---A---B oss-base
> /
> ---o---o---o---o master
>
> with commits X, A and B all recording an identical tree. The oss branch
> (commit X) is now safe to publish.
>
> Once you have done this, further you can:
>
> $ git checkout master
> $ git merge oss-base
>
> which gives you a history of this shape:
>
> X oss
> \
> o---o---A---B oss-base
> / \
> ---o---o---o---o---Y master
>
> This merge Y has to be done carefully. It inherently has to be an evil
> merge because oss-base wants to replace some proprietary stuff with open
> source counterparts while you may want to keep using the proprietary ones
> you have support contract for in your paying customer release you will
> make from the master branch. So at Y, you will most likely be reverting
> some work you did on oss-base branch since it forked from master.
>
> After setting it up, this arrangement allows you to:
>
> - accept changes from public, and/or build changes for public, to advance
> "community version" on the oss branch on top of X;
>
> - from time to time, merge oss to oss-base;
>
> - from time to time, merge oss-base to master.
>
> and the histories will continue like this:
>
> X---C---C---C---C oss
> \ \
> o---o---A---B-----------* oss-base
> / \ \
> ---o---o---o---o---Y---P---P---*---P---P master
>
> with community commits C (either contributed from the public or you
> developed yourself and gave to the community) on oss branch, with
> proprietary commits P that record your own proprietary work on master
> branch. Note that oss-base branch is not used to produce nor record any
> commit on its own---it is merely to ease the merging from oss and master
> by providing X-B link to serve as a convenient common ancestor to make
> later merges easier.
>
> Note also that it would be the most convenient if you kept both the index
> and the working tree intact, if "checkout --orphan" is to be used as an
> ingredient for this workflow. It _might_ actually make sense not to make
> the "git checkout --orphan" an independent feature that can be randomly
> abused or misused, but package the three-command sequence to create the
> A-B-X open triangle above into a separate command, i.e.
>
> $ git branch --orphan oss
>
> would create a new branch "oss" with its own root commit X that records
> the same tree as the current HEAD A, and immediately merge X back into A
> to produce B, again recording the same tree, and advance the current HEAD
> to point at B, like so:
>
> X oss
> \
> ---o---A HEAD --> ---o---A---B HEAD
>
next prev parent reply other threads:[~2010-03-14 21:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-09 22:28 [PATCH v2] git checkout -b: unparent the new branch with -o Erick Mattos
2010-03-12 6:53 ` Junio C Hamano
2010-03-12 7:40 ` Bert Wesarg
2010-04-27 6:35 ` David Kågedal
2010-03-12 16:45 ` Erick Mattos
2010-03-13 7:53 ` Junio C Hamano
2010-03-13 9:10 ` Junio C Hamano
2010-03-14 21:57 ` Erick Mattos [this message]
2010-03-15 2:56 ` Junio C Hamano
2010-03-16 18:18 ` Erick Mattos
2010-03-13 9:33 ` Jakub Narebski
2010-03-13 9:42 ` Junio C Hamano
2010-03-14 21:57 ` Erick Mattos
2010-03-15 2:06 ` Junio C Hamano
2010-03-16 18:17 ` Erick Mattos
2010-03-14 20:46 ` Erick Mattos
2010-03-14 21:58 ` Erick Mattos
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=55bacdd31003141457t7d2cebe3u9854d3c0a55b7da0@mail.gmail.com \
--to=erick.mattos@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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).