Is it possible to get branch names without clone or pull from git?

蓝咒 提交于 2021-02-07 11:45:08

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!