Re: Command to list <pattern> Branches on a specific Remote (i.e. select from rtb's)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
--
Philip



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux