How can it possible to get all names of some remote origin branches?
I started from --remote --list
options, but got redundant origin/HEAD -> origin/master
message and branches from the another origin.
$> git branch --remote --list
origin/HEAD -> origin/master
origin1/develop
origin1/feature/1
origin1/feature/2
origin1/feature/3
origin1/master
origin2/develop
origin2/feature/1
origin2/feature/2
origin2/master
Branches of specific origin could be matched with <pattern>
option, but redundant message is still there. Actually that pattern is not really correct, because some origin's name could be a substring of another origin name, or even some branch.
$> git branch --remote --list origin1*
origin1/HEAD -> origin/master
origin1/develop
origin1/feature/1
origin1/feature/2
origin1/feature/3
origin1/master
What am I looking for is a list of branch names of origin1
, any of them I could use for git checkout
command. Something like that:
develop
feature/1
feature/2
feature/3
master
It's important that it should be done without grep
, sed
, tail
or even ghc -e
wrappers, only with true git
power, because of their unsafeness and variation.