mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Philip Oakley <>
To: "Ævar Arnfjörð Bjarmason" <>
Cc: Git Mailing List <>
Subject: Re: Command to list <pattern> Branches on a specific Remote (i.e. select from rtb's)
Date: Sat, 18 May 2019 20:44:46 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

Hi Ævar,

On 18/05/2019 19:37, Ævar Arnfjörð Bjarmason wrote:
> On Sat, May 18 2019, Philip Oakley wrote:
>> Hi,
>> I'm unsure if there is a command for this.
>> Currently I have 1600+ remote tracking branches (rtb) for my Git repo
>> as it covers both git.git and git-for-windows and some other
>> contributors.
>> Finding a specific rtb for a particular remote looks like there ought
>> to be a simple command ready to do the job, but I haven't found
>> anything.
>> Is there a command or simple simple invocation of branch, show-ref,
>> for-each-ref, etc that can be give a branch pattern and remote name to
>> quickly filter down the list of potential branches to just one or two
>> 24-line screens?
> That's:
>      git for-each-ref 'refs/remotes/<remote>/<pattern>'
>      git branch -a -l '<remote>/<pattern>'
> The latter will conflate <remote> with any local branches you happen to
> have prefixed with <remote>.
> The reason this isn't some easy mode in some command is because there's
> no hard notion that a given remote "owns" a given set of RTB's. It's
> just convention, but they can and do overlap sometimes.
> See the logic in 'git remote remove' that needs to decide if a deletion
> of a remote should delete its remote tracking refs: 7ad2458fad ("Make
> "git-remote rm" delete refs acccording to fetch specs", 2008-06-01)
Thanks, that's magic. I was also conflating the 'pattern' with a grep 
style sub-string search in my exploration.

So, as long as one uses the RTB 'remote name', rather than the remotes 
'remote name' it should all be golden.

I'll add the answer to one on the stackoverflow Q&A's I'd looked at. I 
hadn't put the branch -a and -l options together.

  reply	other threads:[~2019-05-18 19:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-18 15:16 Command to list <pattern> Branches on a specific Remote (i.e. select from rtb's) Philip Oakley
2019-05-18 18:37 ` Ævar Arnfjörð Bjarmason
2019-05-18 19:44   ` Philip Oakley [this message]
2019-05-19  3:07     ` Duy Nguyen
2019-05-19  9:49       ` Philip Oakley
2019-05-28 12:13       ` [PATCH] doc branch: provide examples for listing remote tracking branches Philip Oakley
2019-05-28 13:58         ` Junio C Hamano
2019-05-28 14:17           ` Philip Oakley
2019-05-28 14:51             ` Philip Oakley
2019-05-28 15:51               ` Junio C Hamano
2019-05-28 16:17                 ` Philip Oakley
2019-05-28 23:16                   ` [RFC/PATCH v2] " Philip Oakley
2019-06-10 17:57                     ` Junio C Hamano
2019-06-14 21:00                       ` Philip Oakley
2019-05-19  3:05   ` Command to list <pattern> Branches on a specific Remote (i.e. select from rtb's) Duy Nguyen
2019-05-28 13:57   ` 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:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* 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.
Code repositories for project(s) associated with this public inbox

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 read-only IMAP folder(s) and NNTP newsgroup(s).