From: Jeff King <peff@peff.net>
To: Jed Brown <jed@59A2.org>
Cc: Git List <git@vger.kernel.org>
Subject: Re: Find/prune local branches after upstream branch is deleted?
Date: Fri, 19 Apr 2013 14:05:20 -0400 [thread overview]
Message-ID: <20130419180520.GA22865@sigill.intra.peff.net> (raw)
In-Reply-To: <87bo9a4dfr.fsf@mcs.anl.gov>
On Fri, Apr 19, 2013 at 12:50:48PM -0500, Jed Brown wrote:
> Jeff King <peff@peff.net> writes:
>
> > Try "git branch --merged master" to get a list of branches that have
> > already been merged.
>
> That's what I use, but I was hoping for something more precise. For
> example, a branch that started at 'maint' would show up there, but its
> integration hasn't completed until it makes it back to 'maint'.
Yeah, git has no way of knowing that. You can tell it by asking "git
branch --merged maint" and looking for such topics, of course, but I
think you are trying to remove as much thinking as possible from the
process.
So what is the clue that you would like to use to know that the branch
is stale. Deletion of the branch on the remote?
For that, I don't think there is a single command. You can do "git push
--dry-run --all" and look for new branches that would be pushed, but
that is kind of hacky. The answer you want is:
comm -23 \
<(git for-each-ref --format='%(refname:short)' refs/heads) \
<(git for-each-ref --format='%(refname:short)' refs/remotes/origin |
sed s,origin/,,)
You said you didn't want to script, but I think that is the only option
to answer that question cleanly.
Note that if you wrap that in an alias, you would want to use "bash -c",
as the <() syntax is not understood by many /bin/sh implementations.
-Peff
next prev parent reply other threads:[~2013-04-19 18:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-19 17:11 Find/prune local branches after upstream branch is deleted? Jed Brown
2013-04-19 17:37 ` Jeff King
2013-04-19 17:50 ` Jed Brown
2013-04-19 18:05 ` Jeff King [this message]
2013-04-19 19:30 ` Jed Brown
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=20130419180520.GA22865@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=jed@59A2.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).