Coliban
Coliban

Reputation: 671

How to check (branches or tags) from a remote git repository?

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?

Upvotes: 0

Views: 45

Answers (1)

ElpieKay
ElpieKay

Reputation: 30858

git ls-remote

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.

Upvotes: 2

Related Questions