git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Finding a branch point in git
Date: Wed, 30 May 2012 17:54:15 -0400	[thread overview]
Message-ID: <20120530215415.GB3237@sigill.intra.peff.net> (raw)
In-Reply-To: <CAMP44s0UBsVicuEcwACsm1zTT_jGau_Q20hJv4J_6uvancYJRQ@mail.gmail.com>

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?

> I think it would be easy to support this case if somehow there was a
> way to find all the commits that comprise a branch;
> 
>  % git log branch ^<any-other-branch>
> 
> I could swear I saw such an option, but I've been looking for days and
> I can't find it.

I don't think there is such an option. You have to do something like:

  {
    echo "--not"
    git for-each-ref --format='%(refname)' | grep -v "^$branch\$"
  } |
  git rev-list --stdin $branch

-Peff

  reply	other threads:[~2012-05-30 21:54 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 [this message]
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
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=20120530215415.GB3237@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=felipe.contreras@gmail.com \
    --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).