git-ls-remote
TLDR
List remote refs
$ git ls-remote [origin]
Show only tags$ git ls-remote --tags [origin]
Show only heads$ git ls-remote --heads [origin]
Show specific ref$ git ls-remote [origin] [refs/heads/main]
List refs for URL$ git ls-remote [https://github.com/owner/repo.git]
SYNOPSIS
git ls-remote [options] [repository] [refs]
DESCRIPTION
git ls-remote lists references in a remote repository. It shows branches, tags, and their commit hashes without downloading objects, useful for checking remote state.
The command queries the remote directly, showing current refs. This enables checking tag existence or branch status without fetching. It works with named remotes or direct URLs.
git ls-remote provides remote ref information without downloading.
PARAMETERS
REPOSITORY
Remote name or URL.REFS
Specific refs to show.--heads
Show only heads (branches).--tags
Show only tags.--refs
Show refs only, no peeled tags.--get-url
Show remote URL.--exit-code
Exit with error if no refs found.--help
Display help information.
CAVEATS
Requires network access. Shows refs at query time. Large repos may have many refs.
HISTORY
git ls-remote is a core Git command for inspecting remote references, useful for automation and verification.
SEE ALSO
git-remote(1), git-fetch(1), git-ls-tree(1)


