Is it possible to list remote git branches from a single remote? The following list branches from all the configured remotes:
git branch -r
Is it possible to list remote git branches from a single remote? The following list branches from all the configured remotes:
git branch -r
use git remote show <remote-name> it will list all branches existed in that remote
Example:
git remote show origin or git remote show https://github.com/test/test-repo.git
reference : view docs
Just filter the list
git branch -r | grep origin
Replace origin with desired remote's name.
Is it possible to list remote git branches from a single remote?
Git 2.23 (Q3 2019) does update the documentation to answer that very question:
See commit 1fde99c (28 May 2019) by Philip Oakley (PhilipOakley).
(Merged by Junio C Hamano -- gitster -- in commit ecf55ae, 09 Jul 2019)
doc
branch: provide examples for listing remote tracking branchesThe availability of these pattern selections is not obvious from the man pages.
Provide examples.
The git branch documentation now has:
Listing branches from a specific remote::
------------ $ git branch -r -l '<remote>/<pattern>' <1> $ git for-each-ref 'refs/remotes/<remote>/<pattern>' <2> ------------
<1>Using-awould conflate<remote>with any local branches you happen to have been prefixed with the same<remote>pattern.<2>for-each-refcan take a wide range of options.Patterns will normally need quoting.
You could use rev-parse instead:
git rev-parse --abbrev-ref --symbolic --remotes=<remote-name>