From: Jeff King <peff@peff.net>
To: Johan Herland <johan@herland.net>
Cc: Git mailing list <git@vger.kernel.org>
Subject: Re: Listing commits that are _exclusively_ available on a given branch
Date: Fri, 23 Mar 2012 13:06:41 -0400 [thread overview]
Message-ID: <20120323170640.GA12881@sigill.intra.peff.net> (raw)
In-Reply-To: <CALKQrge-=XExhwxuC14uynpuuO3W+f4YO4=X7kFUx33F3HtnyQ@mail.gmail.com>
On Fri, Mar 23, 2012 at 03:36:33PM +0100, Johan Herland wrote:
> I'm trying to figure out how to list commits on a given branch that
> are not available on any other branch, i.e. the commits that are
> exclusive to my branch.
>
> So far I only have this somewhat brute-force alternative:
>
> git rev-list refs/heads/mybranch --not $(git show-ref --heads | grep
> -v refs/heads/mybranch)
>
> Is it possible to phrase this query in a simpler manner? Preferably by
> not having to list all refs and then run grep on it...
No, I think that is the only way to do it. The algorithm run by rev-list
in that case should be optimal, so there is nothing to improve there.
Syntactically, it's a little bit of a pain because there is no way to
tell rev-list "--all, except for this one branch" short of using grep.
We could add a new syntax for that, but I'm not sure what it would look
like (or if it would be any easier on the eyes than what you have).
You might consider using "git rev-list --stdin" to avoid running into
limits on the command-line length.
-Peff
next prev parent reply other threads:[~2012-03-23 17:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-23 14:36 Listing commits that are _exclusively_ available on a given branch Johan Herland
2012-03-23 17:06 ` Jeff King [this message]
2012-03-23 17:38 ` Junio C Hamano
2012-03-23 17:50 ` Jeff King
2012-03-23 19:39 ` Junio C Hamano
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=20120323170640.GA12881@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=johan@herland.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).