{"thread":{"id":"51123","subject":"Command to list <pattern> Branches on a specific Remote (i.e. select from rtb's)","startedAt":"2019-05-18T15:16:48Z","lastAt":"2019-06-14T21:01:00Z","messageCount":16,"participants":["Philip Oakley","Ævar Arnfjörð Bjarmason","Duy Nguyen","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"375857","messageId":"dcdff07d-77c7-8cb8-fa06-82acda5fe9ec@iee.org","threadId":"51123","inReplyTo":null,"subject":"Command to list <pattern> Branches on a specific Remote (i.e. select from rtb's)","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2019-05-18T15:16:45Z","receivedAt":"2019-05-18T15:16:48Z","isPatch":false,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"Hi,\nI'm unsure if there is a command for this.\n\nCurrently I have 1600+ remote tracking branches (rtb) for my Git repo as \nit covers both git.git and git-for-windows and some other contributors.\n\nFinding a specific rtb for a particular remote looks like there ought to \nbe a simple command ready to do the job, but I haven't found anything.\n\nIs there a command or simple simple invocation of branch, show-ref, \nfor-each-ref, etc that can be give a branch pattern and remote name to \nquickly filter down the list of potential branches to just one or two \n24-line screens?\n\n-- \nPhilip\n\n"},{"id":"375859","messageId":"87lfz3vcbt.fsf@evledraar.gmail.com","threadId":"51123","inReplyTo":"dcdff07d-77c7-8cb8-fa06-82acda5fe9ec@iee.org","subject":"Re: Command to list <pattern> Branches on a specific Remote (i.e. select from rtb's)","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2019-05-18T18:37:10Z","receivedAt":"2019-05-18T18:37:15Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Sat, May 18 2019, Philip Oakley wrote:\n\n> Hi,\n> I'm unsure if there is a command for this.\n>\n> Currently I have 1600+ remote tracking branches (rtb) for my Git repo\n> as it covers both git.git and git-for-windows and some other\n> contributors.\n>\n> Finding a specific rtb for a particular remote looks like there ought\n> to be a simple command ready to do the job, but I haven't found\n> anything.\n>\n> Is there a command or simple simple invocation of branch, show-ref,\n> for-each-ref, etc that can be give a branch pattern and remote name to\n> quickly filter down the list of potential branches to just one or two\n> 24-line screens?\n\nThat's:\n\n    git for-each-ref 'refs/remotes/<remote>/<pattern>'\n    git branch -a -l '<remote>/<pattern>'\n\nThe latter will conflate <remote> with any local branches you happen to\nhave prefixed with <remote>.\n\nThe reason this isn't some easy mode in some command is because there's\nno hard notion that a given remote \"owns\" a given set of RTB's. It's\njust convention, but they can and do overlap sometimes.\n\nSee the logic in 'git remote remove' that needs to decide if a deletion\nof a remote should delete its remote tracking refs: 7ad2458fad (\"Make\n\"git-remote rm\" delete refs acccording to fetch specs\", 2008-06-01)\n"},{"id":"375861","messageId":"720a0b5f-cc20-5b75-8222-68eed77beeea@iee.org","threadId":"51123","inReplyTo":"87lfz3vcbt.fsf@evledraar.gmail.com","subject":"Re: Command to list <pattern> Branches on a specific Remote (i.e. select from rtb's)","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2019-05-18T19:44:46Z","receivedAt":"2019-05-18T19:44:50Z","isPatch":false,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"Hi Ævar,\n\nOn 18/05/2019 19:37, Ævar Arnfjörð Bjarmason wrote:\n> On Sat, May 18 2019, Philip Oakley wrote:\n>\n>> Hi,\n>> I'm unsure if there is a command for this.\n>>\n>> Currently I have 1600+ remote tracking branches (rtb) for my Git repo\n>> as it covers both git.git and git-for-windows and some other\n>> contributors.\n>>\n>> Finding a specific rtb for a particular remote looks like there ought\n>> to be a simple command ready to do the job, but I haven't found\n>> anything.\n>>\n>> Is there a command or simple simple invocation of branch, show-ref,\n>> for-each-ref, etc that can be give a branch pattern and remote name to\n>> quickly filter down the list of potential branches to just one or two\n>> 24-line screens?\n> That's:\n>\n>      git for-each-ref 'refs/remotes/<remote>/<pattern>'\n>      git branch -a -l '<remote>/<pattern>'\n>\n> The latter will conflate <remote> with any local branches you happen to\n> have prefixed with <remote>.\n>\n> The reason this isn't some easy mode in some command is because there's\n> no hard notion that a given remote \"owns\" a given set of RTB's. It's\n> just convention, but they can and do overlap sometimes.\n>\n> See the logic in 'git remote remove' that needs to decide if a deletion\n> of a remote should delete its remote tracking refs: 7ad2458fad (\"Make\n> \"git-remote rm\" delete refs acccording to fetch specs\", 2008-06-01)\nThanks, that's magic. I was also conflating the 'pattern' with a grep \nstyle sub-string search in my exploration.\n\nSo, as long as one uses the RTB 'remote name', rather than the remotes \n'remote name' it should all be golden.\n\nI'll add the answer to one on the stackoverflow Q&A's I'd looked at. I \nhadn't put the branch -a and -l options together.\n--\nPhilip\n"},{"id":"375881","messageId":"a83183ec-a87a-b080-6e72-489e7fc1ebd6@iee.org","threadId":"51123","inReplyTo":"CACsJy8CwY8gzeWa9kNRX3ecez1JGiQiaOknbAoU7S+hiXBoUGQ@mail.gmail.com","subject":"Re: Command to list <pattern> Branches on a specific Remote (i.e. select from rtb's)","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2019-05-19T09:49:53Z","receivedAt":"2019-05-19T17:40:57Z","isPatch":false,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"\nOn 19/05/2019 04:07, Duy Nguyen wrote:\n> On Sun, May 19, 2019 at 2:55 AM Philip Oakley <philipoakley@iee.org> wrote:\n>> I'll add the answer to one on the stackoverflow Q&A's I'd looked at. I\n>> hadn't put the branch -a and -l options together.\n> Maybe update/add some examples in our man pages too.\ndeffo on an update! For the -r option I did not expect to be able to add \na remote name (no option listed, nor method noted).\n\nJust re-read the branch(1) man page and much of it is buried in the \nfirst paragraph with/for the --list option with lots of caveats and \npairings.\n--\nPhilip\n"},{"id":"375890","messageId":"CACsJy8B_3ZytR+5HvOax=ngw7ECse8_5ajkOvUEcOj3MuNxQvQ@mail.gmail.com","threadId":"51123","inReplyTo":"87lfz3vcbt.fsf@evledraar.gmail.com","subject":"Re: Command to list <pattern> Branches on a specific Remote (i.e. select from rtb's)","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2019-05-19T03:05:52Z","receivedAt":"2019-05-19T18:58:25Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sun, May 19, 2019 at 1:41 AM Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n> That's:\n>\n>     git for-each-ref 'refs/remotes/<remote>/<pattern>'\n>     git branch -a -l '<remote>/<pattern>'\n>\n> The latter will conflate <remote> with any local branches you happen to\n> have prefixed with <remote>.\n\nThat problem should be gone if you use -r instead of -a.\n-- \nDuy\n"},{"id":"375891","messageId":"CACsJy8CwY8gzeWa9kNRX3ecez1JGiQiaOknbAoU7S+hiXBoUGQ@mail.gmail.com","threadId":"51123","inReplyTo":"720a0b5f-cc20-5b75-8222-68eed77beeea@iee.org","subject":"Re: Command to list <pattern> Branches on a specific Remote (i.e. select from rtb's)","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2019-05-19T03:07:23Z","receivedAt":"2019-05-19T19:43:27Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sun, May 19, 2019 at 2:55 AM Philip Oakley <philipoakley@iee.org> wrote:\n> I'll add the answer to one on the stackoverflow Q&A's I'd looked at. I\n> hadn't put the branch -a and -l options together.\n\nMaybe update/add some examples in our man pages too.\n-- \nDuy\n"},{"id":"376294","messageId":"20190528121315.2604-1-philipoakley@iee.org","threadId":"51123","inReplyTo":"CACsJy8CwY8gzeWa9kNRX3ecez1JGiQiaOknbAoU7S+hiXBoUGQ@mail.gmail.com","subject":"[PATCH] doc branch: provide examples for listing remote tracking branches","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2019-05-28T12:13:15Z","receivedAt":"2019-05-28T12:13:25Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"The availability of these pattern selections is not obvious from\nthe man pages, as per mail thread <87lfz3vcbt.fsf@evledraar.gmail.com>.\n\nProvide examples.\n\nSigned-off-by: Philip Oakley <philipoakley@iee.org>\n---\n\nin response to \n<CACsJy8CwY8gzeWa9kNRX3ecez1JGiQiaOknbAoU7S+hiXBoUGQ@mail.gmail.com>\nhttps://public-inbox.org/git/?q=%3CCACsJy8CwY8gzeWa9kNRX3ecez1JGiQiaOknbAoU7S%2BhiXBoUGQ%40mail.gmail.com%3E\n\nto: \"Git Mailing List <git@vger.kernel.org>\"\ncc: \"Duy Nguyen <pclouds@gmail.com>\"\ncc: \"Ævar Arnfjörð Bjarmason <avarab@gmail.com>\"\n\n Documentation/git-branch.txt | 12 ++++++++++++\n 1 file changed, 12 insertions(+)\n\ndiff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt\nindex 3bd83a7cbd..7ed91f1be3 100644\n--- a/Documentation/git-branch.txt\n+++ b/Documentation/git-branch.txt\n@@ -314,6 +314,18 @@ $ git branch -D test                                    <2>\n <2> Delete the \"test\" branch even if the \"master\" branch (or whichever branch\n     is currently checked out) does not have all commits from the test branch.\n \n+Listing branches from a specific remote::\n++\n+------------\n+$ git branch -a -l '<remote>/<pattern>'                 <1>\n+$ git for-each-ref 'refs/remotes/<remote>/<pattern>'    <2>\n+------------\n++\n+<1> This can conflate <remote> with any local branches you happen to\n+    have been prefixed with the same <remote> pattern.\n+<2> `for-each-ref` can take a wide range of options. See linkgit:git-for-each-ref[1]\n+\n+Patterns will normally need quoting.\n \n NOTES\n -----\n-- \n2.22.0.rc1.windows.1\n\n"},{"id":"376302","messageId":"xmqqa7f6el6b.fsf@gitster-ct.c.googlers.com","threadId":"51123","inReplyTo":"87lfz3vcbt.fsf@evledraar.gmail.com","subject":"Re: Command to list <pattern> Branches on a specific Remote (i.e. select from rtb's)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-05-28T13:57:32Z","receivedAt":"2019-05-28T13:57:40Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> That's:\n>\n>     git for-each-ref 'refs/remotes/<remote>/<pattern>'\n>     git branch -a -l '<remote>/<pattern>'\n>\n> The latter will conflate <remote> with any local branches you happen to\n> have prefixed with <remote>.\n\nWouldn't \"branch -r -l <remote>/<pattern>\" be without that downside?\nWhy use \"-a\"?\n"},{"id":"376303","messageId":"xmqq5zpuel4m.fsf@gitster-ct.c.googlers.com","threadId":"51123","inReplyTo":"20190528121315.2604-1-philipoakley@iee.org","subject":"Re: [PATCH] doc branch: provide examples for listing remote tracking branches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-05-28T13:58:33Z","receivedAt":"2019-05-28T13:58:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Philip Oakley <philipoakley@iee.org> writes:\n\n> The availability of these pattern selections is not obvious from\n> the man pages, as per mail thread <87lfz3vcbt.fsf@evledraar.gmail.com>.\n>\n> Provide examples.\n>\n> Signed-off-by: Philip Oakley <philipoakley@iee.org>\n> ---\n\nPlease try again, perhaps after reading\n<CACsJy8B_3ZytR+5HvOax=ngw7ECse8_5ajkOvUEcOj3MuNxQvQ@mail.gmail.com>\n\nThanks.\n\n>\n> in response to \n> <CACsJy8CwY8gzeWa9kNRX3ecez1JGiQiaOknbAoU7S+hiXBoUGQ@mail.gmail.com>\n> https://public-inbox.org/git/?q=%3CCACsJy8CwY8gzeWa9kNRX3ecez1JGiQiaOknbAoU7S%2BhiXBoUGQ%40mail.gmail.com%3E\n>\n> to: \"Git Mailing List <git@vger.kernel.org>\"\n> cc: \"Duy Nguyen <pclouds@gmail.com>\"\n> cc: \"Ævar Arnfjörð Bjarmason <avarab@gmail.com>\"\n>\n>  Documentation/git-branch.txt | 12 ++++++++++++\n>  1 file changed, 12 insertions(+)\n>\n> diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt\n> index 3bd83a7cbd..7ed91f1be3 100644\n> --- a/Documentation/git-branch.txt\n> +++ b/Documentation/git-branch.txt\n> @@ -314,6 +314,18 @@ $ git branch -D test                                    <2>\n>  <2> Delete the \"test\" branch even if the \"master\" branch (or whichever branch\n>      is currently checked out) does not have all commits from the test branch.\n>  \n> +Listing branches from a specific remote::\n> ++\n> +------------\n> +$ git branch -a -l '<remote>/<pattern>'                 <1>\n> +$ git for-each-ref 'refs/remotes/<remote>/<pattern>'    <2>\n> +------------\n> ++\n> +<1> This can conflate <remote> with any local branches you happen to\n> +    have been prefixed with the same <remote> pattern.\n> +<2> `for-each-ref` can take a wide range of options. See linkgit:git-for-each-ref[1]\n> +\n> +Patterns will normally need quoting.\n>  \n>  NOTES\n>  -----\n"},{"id":"376305","messageId":"d44cbf49-dea9-c518-17e3-f9b252f2dd06@iee.org","threadId":"51123","inReplyTo":"xmqq5zpuel4m.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH] doc branch: provide examples for listing remote tracking branches","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2019-05-28T14:17:09Z","receivedAt":"2019-05-28T14:17:13Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"On 28/05/2019 14:58, Junio C Hamano wrote:\n> Philip Oakley <philipoakley@iee.org> writes:\n>\n>> The availability of these pattern selections is not obvious from\n>> the man pages, as per mail thread <87lfz3vcbt.fsf@evledraar.gmail.com>.\n>>\n>> Provide examples.\n>>\n>> Signed-off-by: Philip Oakley <philipoakley@iee.org>\n>> ---\n> Please try again, perhaps after reading\n> <CACsJy8B_3ZytR+5HvOax=ngw7ECse8_5ajkOvUEcOj3MuNxQvQ@mail.gmail.com>\nHi Junio\nSorry, I'm not understanding the comment, even having re-read the thread.\nPhilip\n>\n> Thanks.\n>\n>> in response to\n>> <CACsJy8CwY8gzeWa9kNRX3ecez1JGiQiaOknbAoU7S+hiXBoUGQ@mail.gmail.com>\n>> https://public-inbox.org/git/?q=%3CCACsJy8CwY8gzeWa9kNRX3ecez1JGiQiaOknbAoU7S%2BhiXBoUGQ%40mail.gmail.com%3E\n>>\n>> to: \"Git Mailing List <git@vger.kernel.org>\"\n>> cc: \"Duy Nguyen <pclouds@gmail.com>\"\n>> cc: \"Ævar Arnfjörð Bjarmason <avarab@gmail.com>\"\n>>\n>>   Documentation/git-branch.txt | 12 ++++++++++++\n>>   1 file changed, 12 insertions(+)\n>>\n>> diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt\n>> index 3bd83a7cbd..7ed91f1be3 100644\n>> --- a/Documentation/git-branch.txt\n>> +++ b/Documentation/git-branch.txt\n>> @@ -314,6 +314,18 @@ $ git branch -D test                                    <2>\n>>   <2> Delete the \"test\" branch even if the \"master\" branch (or whichever branch\n>>       is currently checked out) does not have all commits from the test branch.\n>>   \n>> +Listing branches from a specific remote::\n>> ++\n>> +------------\n>> +$ git branch -a -l '<remote>/<pattern>'                 <1>\n>> +$ git for-each-ref 'refs/remotes/<remote>/<pattern>'    <2>\n>> +------------\n>> ++\n>> +<1> This can conflate <remote> with any local branches you happen to\n>> +    have been prefixed with the same <remote> pattern.\n>> +<2> `for-each-ref` can take a wide range of options. See linkgit:git-for-each-ref[1]\n>> +\n>> +Patterns will normally need quoting.\n>>   \n>>   NOTES\n>>   -----\n\n"},{"id":"376307","messageId":"48b03739-b8f7-4d94-15dd-cf7936215a0e@iee.org","threadId":"51123","inReplyTo":"d44cbf49-dea9-c518-17e3-f9b252f2dd06@iee.org","subject":"Re: [PATCH] doc branch: provide examples for listing remote tracking branches","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2019-05-28T14:51:21Z","receivedAt":"2019-05-28T14:51:26Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"Hi Junio,\n\nOn 28/05/2019 15:17, Philip Oakley wrote:\n> On 28/05/2019 14:58, Junio C Hamano wrote:\n>> Philip Oakley <philipoakley@iee.org> writes:\n>>\n>>> The availability of these pattern selections is not obvious from\n>>> the man pages, as per mail thread <87lfz3vcbt.fsf@evledraar.gmail.com>.\n>>>\n>>> Provide examples.\n>>>\n>>> Signed-off-by: Philip Oakley <philipoakley@iee.org>\n>>> ---\n>> Please try again, perhaps after reading\n>> <CACsJy8B_3ZytR+5HvOax=ngw7ECse8_5ajkOvUEcOj3MuNxQvQ@mail.gmail.com>\n> Hi Junio\n> Sorry, I'm not understanding the comment, even having re-read the thread.\n> Philip\nI guess you were referring to you more recent reply to Ævar.\n\nHowever, isn't `-r <pattern>` broken?\n\nphili@Philip-Win10 MINGW64 /c/git-sdk-64/usr/src/git (branch-patterns)\n$ git branch -a -l 'junio/*'\n   remotes/junio/maint\n   remotes/junio/master\n   remotes/junio/next\n   remotes/junio/pu\n   remotes/junio/todo\n\nphili@Philip-Win10 MINGW64 /c/git-sdk-64/usr/src/git (branch-patterns)\n$ git branch -a -r 'junio/*'\nfatal: -a and -r options to 'git branch' do not make sense with a branch \nname\n\nphili@Philip-Win10 MINGW64 /c/git-sdk-64/usr/src/git (branch-patterns)\n$ git branch -r 'junio/*'\nfatal: -a and -r options to 'git branch' do not make sense with a branch \nname\n\nphili@Philip-Win10 MINGW64 /c/git-sdk-64/usr/src/git (branch-patterns)\n$ git branch -r\n   dscho-git/add-i-fixes\n   dscho-git/add-i-in-c-all-except-patch\n   dscho-git/add-i-in-c-status-and-help\n...\n\n\nThe docs for the branch -r and -a option could do with mentioning that \nthey are meant to accept a pattern, as all the other mentions are hidden \nmid paragraph.\n\nI'll prepare a v2 for the docs, but haven't the time at the moment to \ninvestigate the code fail (missing a test?).\n\nPhilip\n\n>>\n>> Thanks.\n>>\n>>> in response to\n>>> <CACsJy8CwY8gzeWa9kNRX3ecez1JGiQiaOknbAoU7S+hiXBoUGQ@mail.gmail.com>\n>>> https://public-inbox.org/git/?q=%3CCACsJy8CwY8gzeWa9kNRX3ecez1JGiQiaOknbAoU7S%2BhiXBoUGQ%40mail.gmail.com%3E \n>>>\n>>>\n>>> to: \"Git Mailing List <git@vger.kernel.org>\"\n>>> cc: \"Duy Nguyen <pclouds@gmail.com>\"\n>>> cc: \"Ævar Arnfjörð Bjarmason <avarab@gmail.com>\"\n>>>\n>>>   Documentation/git-branch.txt | 12 ++++++++++++\n>>>   1 file changed, 12 insertions(+)\n>>>\n>>> diff --git a/Documentation/git-branch.txt \n>>> b/Documentation/git-branch.txt\n>>> index 3bd83a7cbd..7ed91f1be3 100644\n>>> --- a/Documentation/git-branch.txt\n>>> +++ b/Documentation/git-branch.txt\n>>> @@ -314,6 +314,18 @@ $ git branch -D \n>>> test                                    <2>\n>>>   <2> Delete the \"test\" branch even if the \"master\" branch (or \n>>> whichever branch\n>>>       is currently checked out) does not have all commits from the \n>>> test branch.\n>>>   +Listing branches from a specific remote::\n>>> ++\n>>> +------------\n>>> +$ git branch -a -l '<remote>/<pattern>'                 <1>\n>>> +$ git for-each-ref 'refs/remotes/<remote>/<pattern>'    <2>\n>>> +------------\n>>> ++\n>>> +<1> This can conflate <remote> with any local branches you happen to\n>>> +    have been prefixed with the same <remote> pattern.\n>>> +<2> `for-each-ref` can take a wide range of options. See \n>>> linkgit:git-for-each-ref[1]\n>>> +\n>>> +Patterns will normally need quoting.\n>>>     NOTES\n>>>   -----\n>\n\n"},{"id":"376311","messageId":"xmqqftoy60hq.fsf@gitster-ct.c.googlers.com","threadId":"51123","inReplyTo":"48b03739-b8f7-4d94-15dd-cf7936215a0e@iee.org","subject":"Re: [PATCH] doc branch: provide examples for listing remote tracking branches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-05-28T15:51:29Z","receivedAt":"2019-05-28T15:51:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Philip Oakley <philipoakley@iee.org> writes:\n\n> However, isn't `-r <pattern>` broken?\n\nNo.\n\n> phili@Philip-Win10 MINGW64 /c/git-sdk-64/usr/src/git (branch-patterns)\n> $ git branch -a -l 'junio/*'\n\nYou are asking \"branch --all --list\" here.\n\n> $ git branch -a -r 'junio/*'\n> fatal: -a and -r options to 'git branch' do not make sense with a\n> branch name\n\nYou wanted to ask \"branch --remote --list\" instead of \"branch --all\n--remote\", no?\n\n"},{"id":"376313","messageId":"2ea35ad4-4b33-0ece-4de4-b2e92a100d9a@iee.org","threadId":"51123","inReplyTo":"xmqqftoy60hq.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH] doc branch: provide examples for listing remote tracking branches","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2019-05-28T16:17:49Z","receivedAt":"2019-05-28T16:17:54Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"On 28/05/2019 16:51, Junio C Hamano wrote:\n> Philip Oakley <philipoakley@iee.org> writes:\n>\n>> However, isn't `-r <pattern>` broken?\n> No.\nThen why does it say:\n     fatal: -a and -r options to 'git branch' do not make sense with a \nbranch name\n\nwhen there is no `-a` given?\n>\n>> phili@Philip-Win10 MINGW64 /c/git-sdk-64/usr/src/git (branch-patterns)\n>> $ git branch -a -l 'junio/*'\n> You are asking \"branch --all --list\" here.\n>\n>> $ git branch -a -r 'junio/*'\n>> fatal: -a and -r options to 'git branch' do not make sense with a\n>> branch name\n> You wanted to ask \"branch --remote --list\" instead of \"branch --all\n> --remote\", no?\n>\nThe initial expectation was that a simple \"--remote <pattern>\" would be \nall that was required to list the rtbs with the sub-pattern (see fatal \nabove, which is maybe how Ævar got his -a formulation). But it now \nappears that we/I need the --list, to allow a pattern, and either -a, or \n-r, to include the rtbs in the list.\n\nSo ultimately, yes, to just get the rtbs of a specific remote one needs \nyour \"branch --remote --list `<remote>/*' \"formulation.\n\nPhilip\n"},{"id":"376374","messageId":"20190528231605.10108-1-philipoakley@iee.org","threadId":"51123","inReplyTo":"2ea35ad4-4b33-0ece-4de4-b2e92a100d9a@iee.org","subject":"[RFC/PATCH v2] doc branch: provide examples for listing remote tracking branches","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2019-05-28T23:16:05Z","receivedAt":"2019-05-28T23:16:17Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"The availability of these pattern selections is not obvious from\nthe man pages, as per mail thread <87lfz3vcbt.fsf@evledraar.gmail.com>.\n\nProvide examples.\n\nRe-order the `git branch` synopsis to emphasise the `--list <pattern>`\npairing. Also expand and reposition the `all/remotes` options.\n\nSplit the over-long description into three parts so that the <pattern>\ndescription can be seen.\n\nClarify that the `all/remotes` options require the --list if patterns\nare to be used.\n\nAdd examples of listing remote tracking branches that match a pattern,\nincluding `git for-each-ref` which has more options.\n\nImprove the -a/-r warning message. The message confused this author\nas the combined -a and -r options had not been given, though a pattern\nhad. Specifically guide the user that maybe they needed the --list\noption to enable a remote branch pattern selection.\n\nSigned-off-by: Philip Oakley <philipoakley@iee.org>\n---\n\nin response to \n<2ea35ad4-4b33-0ece-4de4-b2e92a100d9a@iee.org>\nthread: https://public-inbox.org/git/?q=%3CCACsJy8CwY8gzeWa9kNRX3ecez1JGiQiaOknbAoU7S%2BhiXBoUGQ%40mail.gmail.com%3E\n\nto: Git Mailing List <git@vger.kernel.org>\ncc: Duy Nguyen <pclouds@gmail.com>\ncc: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\ncc: Junio C Hamano <gitster@pobox.com>\n\n\n Documentation/git-branch.txt | 32 ++++++++++++++++++++++++++------\n builtin/branch.c             |  3 ++-\n 2 files changed, 28 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt\nindex 3bd83a7cbd..c57f6a15c6 100644\n--- a/Documentation/git-branch.txt\n+++ b/Documentation/git-branch.txt\n@@ -8,12 +8,14 @@ git-branch - List, create, or delete branches\n SYNOPSIS\n --------\n [verse]\n-'git branch' [--color[=<when>] | --no-color] [-r | -a]\n-\t[--list] [-v [--abbrev=<length> | --no-abbrev]]\n+'git branch' [--color[=<when>] | --no-color]\n+\t[-v [--abbrev=<length> | --no-abbrev]]\n \t[--column[=<options>] | --no-column] [--sort=<key>]\n \t[(--merged | --no-merged) [<commit>]]\n \t[--contains [<commit]] [--no-contains [<commit>]]\n-\t[--points-at <object>] [--format=<format>] [<pattern>...]\n+\t[--points-at <object>] [--format=<format>]\n+\t[(-r | --remotes) | (-a | --all)]\n+\t[--list] [<pattern>...]\n 'git branch' [--track | --no-track] [-f] <branchname> [<start-point>]\n 'git branch' (--set-upstream-to=<upstream> | -u <upstream>) [<branchname>]\n 'git branch' --unset-upstream [<branchname>]\n@@ -28,11 +30,15 @@ DESCRIPTION\n If `--list` is given, or if there are no non-option arguments, existing\n branches are listed; the current branch will be highlighted with an\n asterisk.  Option `-r` causes the remote-tracking branches to be listed,\n-and option `-a` shows both local and remote branches. If a `<pattern>`\n+and option `-a` shows both local and remote branches.\n+\n+If a `<pattern>`\n is given, it is used as a shell wildcard to restrict the output to\n matching branches. If multiple patterns are given, a branch is shown if\n-it matches any of the patterns.  Note that when providing a\n-`<pattern>`, you must use `--list`; otherwise the command is interpreted\n+it matches any of the patterns.\n+\n+Note that when providing a\n+`<pattern>`, you must use `--list`; otherwise the command may be interpreted\n as branch creation.\n \n With `--contains`, shows only the branches that contain the named commit\n@@ -149,10 +155,12 @@ This option is only applicable in non-verbose mode.\n -r::\n --remotes::\n \tList or delete (if used with -d) the remote-tracking branches.\n+\tCombine with `--list` to match the optional pattern(s).\n \n -a::\n --all::\n \tList both remote-tracking branches and local branches.\n+\tCombine with `--list` to match optional pattern(s).\n \n -l::\n --list::\n@@ -314,6 +322,18 @@ $ git branch -D test                                    <2>\n <2> Delete the \"test\" branch even if the \"master\" branch (or whichever branch\n     is currently checked out) does not have all commits from the test branch.\n \n+Listing branches from a specific remote::\n++\n+------------\n+$ git branch -r -l '<remote>/<pattern>'                 <1>\n+$ git for-each-ref 'refs/remotes/<remote>/<pattern>'    <2>\n+------------\n++\n+<1> Using `-a` would conflate <remote> with any local branches you happen to\n+    have been prefixed with the same <remote> pattern.\n+<2> `for-each-ref` can take a wide range of options. See linkgit:git-for-each-ref[1]\n+\n+Patterns will normally need quoting.\n \n NOTES\n -----\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 1be727209b..30906d4526 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -810,7 +810,8 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \t\tstrbuf_release(&buf);\n \t} else if (argc > 0 && argc <= 2) {\n \t\tif (filter.kind != FILTER_REFS_BRANCHES)\n-\t\t\tdie(_(\"-a and -r options to 'git branch' do not make sense with a branch name\"));\n+\t\t\tdie(_(\"The -a, and -r, options to 'git branch' do not take a branch name.\\n\"\n+\t\t\t\t  \"Did you mean to use: -a|-r --list <pattern>?\"));\n \n \t\tif (track == BRANCH_TRACK_OVERRIDE)\n \t\t\tdie(_(\"the '--set-upstream' option is no longer supported. Please use '--track' or '--set-upstream-to' instead.\"));\n-- \n2.22.0.rc1.windows.1.33.gc7da05f206\n\n"},{"id":"376958","messageId":"xmqqtvcxmig3.fsf@gitster-ct.c.googlers.com","threadId":"51123","inReplyTo":"20190528231605.10108-1-philipoakley@iee.org","subject":"Re: [RFC/PATCH v2] doc branch: provide examples for listing remote tracking branches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-06-10T17:57:48Z","receivedAt":"2019-06-10T17:57:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Philip Oakley <philipoakley@iee.org> writes:\n\n> The availability of these pattern selections is not obvious from\n> the man pages, as per mail thread <87lfz3vcbt.fsf@evledraar.gmail.com>.\n>\n> Provide examples.\n>\n> Re-order the `git branch` synopsis to emphasise the `--list <pattern>`\n> pairing. Also expand and reposition the `all/remotes` options.\n>\n> Split the over-long description into three parts so that the <pattern>\n> description can be seen.\n>\n> Clarify that the `all/remotes` options require the --list if patterns\n> are to be used.\n>\n> Add examples of listing remote tracking branches that match a pattern,\n> including `git for-each-ref` which has more options.\n>\n> Improve the -a/-r warning message. The message confused this author\n> as the combined -a and -r options had not been given, though a pattern\n> had. Specifically guide the user that maybe they needed the --list\n> option to enable a remote branch pattern selection.\n>\n> Signed-off-by: Philip Oakley <philipoakley@iee.org>\n> ---\n>\n> in response to \n> <2ea35ad4-4b33-0ece-4de4-b2e92a100d9a@iee.org>\n> thread: https://public-inbox.org/git/?q=%3CCACsJy8CwY8gzeWa9kNRX3ecez1JGiQiaOknbAoU7S%2BhiXBoUGQ%40mail.gmail.com%3E\n>\n> to: Git Mailing List <git@vger.kernel.org>\n> cc: Duy Nguyen <pclouds@gmail.com>\n> cc: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> cc: Junio C Hamano <gitster@pobox.com>\n\nThis looks reasonable to me---is it ready to go even with its RFC prefix?\n"},{"id":"377258","messageId":"024373d9-e032-1af8-ba26-439ad5620bf5@iee.org","threadId":"51123","inReplyTo":"xmqqtvcxmig3.fsf@gitster-ct.c.googlers.com","subject":"Re: [RFC/PATCH v2] doc branch: provide examples for listing remote tracking branches","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2019-06-14T21:00:52Z","receivedAt":"2019-06-14T21:01:00Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"Hi Junio,\n\nOn 10/06/2019 18:57, Junio C Hamano wrote:\n> Philip Oakley <philipoakley@iee.org> writes:\n>\n>> The availability of these pattern selections is not obvious from\n>> the man pages, as per mail thread <87lfz3vcbt.fsf@evledraar.gmail.com>.\n>>\n>> Provide examples.\n>>\n>> Re-order the `git branch` synopsis to emphasise the `--list <pattern>`\n>> pairing. Also expand and reposition the `all/remotes` options.\n>>\n>> Split the over-long description into three parts so that the <pattern>\n>> description can be seen.\n>>\n>> Clarify that the `all/remotes` options require the --list if patterns\n>> are to be used.\n>>\n>> Add examples of listing remote tracking branches that match a pattern,\n>> including `git for-each-ref` which has more options.\n>>\n>> Improve the -a/-r warning message. The message confused this author\n>> as the combined -a and -r options had not been given, though a pattern\n>> had. Specifically guide the user that maybe they needed the --list\n>> option to enable a remote branch pattern selection.\n>>\n>> Signed-off-by: Philip Oakley <philipoakley@iee.org>\n>> ---\n>>\n>> in response to\n>> <2ea35ad4-4b33-0ece-4de4-b2e92a100d9a@iee.org>\n>> thread: https://public-inbox.org/git/?q=%3CCACsJy8CwY8gzeWa9kNRX3ecez1JGiQiaOknbAoU7S%2BhiXBoUGQ%40mail.gmail.com%3E\n>>\n>> to: Git Mailing List <git@vger.kernel.org>\n>> cc: Duy Nguyen <pclouds@gmail.com>\n>> cc: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n>> cc: Junio C Hamano <gitster@pobox.com>\n> This looks reasonable to me---is it ready to go even with its RFC prefix?\n\nYes; the RFC was only in regard of the die() message change as it \ntouches real code;-)\n\n\nFollowing the post, Stolee's coverage report, it was noted that the \ndie() wasn't actually tested, so I sent a quick follow-up of a potential \ntest \nhttps://public-inbox.org/git/f28dd5b1-fda8-cf51-5582-067a7d2c2472@iee.org/ \nwhich is a proper RFC...\n\n\nI did not attempt to see if any other dies()'s were untested, just \ncopied one that was..\n\nPhilip\n\n(currently travelling)\n\n"}]}