问题
I want to get all branch names of a git repository. Currently, I clone the repository then get them on local machine. This is inefficient because all I need is names and nothing else.
I wonder if it is possible to do that? If so, what command I can use.
回答1:
Locally, without cloning, you can type (using git ls-remote):
git ls-remote /url/of/the/upstream/repo
That will list of the remote HEADS and their associated branches
来源:https://stackoverflow.com/questions/25765237/is-it-possible-to-get-branch-names-without-clone-or-pull-from-git