From: Felipe Contreras <felipe.contreras@gmail.com>
To: PJ Weisberg <pj@irregularexpressions.net>
Cc: Jeff King <peff@peff.net>, git@vger.kernel.org
Subject: Re: Finding a branch point in git
Date: Fri, 1 Jun 2012 11:15:20 +0200 [thread overview]
Message-ID: <CAMP44s1cETpXHMtUsq__FpFSOg9yLmh1A9uYtiTp-K6yEC4AhA@mail.gmail.com> (raw)
In-Reply-To: <CAJsNXTkWKP9xY-yBQF6PuF_YyGshV5xaXG-oBWAO138cFUyT1g@mail.gmail.com>
On Thu, May 31, 2012 at 10:37 PM, PJ Weisberg
<pj@irregularexpressions.net> wrote:
> On Thu, May 31, 2012 at 8:27 AM, Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
>> On Wed, May 30, 2012 at 11:54 PM, Jeff King <peff@peff.net> wrote:
>>> On Wed, May 30, 2012 at 07:07:39PM +0200, Felipe Contreras wrote:
>>>
>>>> On Mon, May 28, 2012 at 9:06 PM, Jeff King <peff@peff.net> wrote:
>>>> > On Mon, May 28, 2012 at 02:36:04PM +0200, Felipe Contreras wrote:
>>>> >
>>>> >> > What about a history with multiple branches?
>>>> >> >
>>>> >> > --X--A--B--C--D----E (master)
>>>> >> > \ /
>>>> >> > G--H--I---J (branch X)
>>>> >> > \ /
>>>> >> > K--L (branch Y)
>>>> >> [...]
>>>> >>
>>>> >> Yes, but then you would need to specify a second branch. I would avoid
>>>> >> that if possible.
>>>> >
>>>> > I agree that is less nice. But I don't think the operation is
>>>> > well-defined with a single branch. If you ask for "when did branch X
>>>> > split", then in the above graph it is unclear if you meant "split from
>>>> > master", or "split from Y".
>>>>
>>>> If you look from the context that I explained in the first mail; it
>>>> would be from *any* branch; IOW; find the first commit from branch X
>>>> (G), and then find the parent. That would be the first commit where
>>>> branch X started.
>>>
>>> I'm not sure that's possible, though, in the face of criss-cross merges.
>>> How do we distinguish the history above from one in which branch Y was
>>> forked from master at G, and then branch X was forked from branch Y at
>>> H?
>>
>> That is true, but we could use the algorithm used by name-rev: G would
>> have a distance 3 from branch X, and distance 2 from Y, so it would be
>> considered part of branch Y.
>>
>> Sure, it's not possible to know _for sure_, but this is a bit like
>> renames; we don't really know if a file was renamed or not, but we can
>> make a good guess.
>
> Obviously G is part of branch Y, branch X, and branch master. I'm
> sure I'm missing the whole point of this exercise, because it seems to
> me that it's just needlessly confusing to say anything else.
It's not about which commit is part of which branch, but figuring out
which is the first commit that was created being in branch Y.
I don't see a tremendous value on this, but there is some, for example:
% git rebase --onto master branch_Y@{tail} branch_Y
Depending on the case, this might not be what you want, but sometimes
it might, the problem is that you can't know automatically if
branch_Y@{tail} is G, or K. So normally you would fire gitk and select
the commit that you want, which is not a big deal, but still, it would
be nice if the tail of a branch was recorded somehow.
To be clear, if I do:
% git checkout -b branch_Y
% git commit <- this would be branch_Y's tail
% git rebase --onto master <- now branch_Y's tail would be right on
top of master
Cheers.
--
Felipe Contreras
next prev parent reply other threads:[~2012-06-01 9:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-27 12:37 Finding a branch point in git Felipe Contreras
2012-05-28 6:20 ` Jeff King
2012-05-28 12:36 ` Felipe Contreras
2012-05-28 19:06 ` Jeff King
2012-05-30 17:07 ` Felipe Contreras
2012-05-30 21:54 ` Jeff King
2012-05-31 15:27 ` Felipe Contreras
2012-05-31 16:10 ` Felipe Contreras
2012-05-31 20:37 ` PJ Weisberg
2012-06-01 9:15 ` Felipe Contreras [this message]
2012-05-31 15:37 ` Martin Langhoff
2012-05-30 16:52 ` Felipe Contreras
2012-05-30 21:45 ` Jeff King
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=CAMP44s1cETpXHMtUsq__FpFSOg9yLmh1A9uYtiTp-K6yEC4AhA@mail.gmail.com \
--to=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=pj@irregularexpressions.net \
/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).