When I want to check, for examples, the tags in a git repo, I do git branch
or git tag
. But this can be done in an already cloned repository. How can I check branches and tags in a remote git repo?
To list all the refs in the remote repository:
git ls-remote <url_of_repository>
To list tags only:
git ls-remote --tags <url_of_repository>
To list branches only:
git ls-remote --heads <url_of_repository>
To list a specific ref:
git ls-remote <url_of_repository> <ref_name>
You don't have to be in a git repository to run this command. But if you are in a local repository, you could use a remote like origin
instead of the long url. If you'd like to see the log of a ref, you still need to fetch it down to a local repository.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.