git-ls-remote
List remote repository references
TLDR
List remote refs
SYNOPSIS
git ls-remote [options] [repository] [refs]
DESCRIPTION
git ls-remote lists references in a remote repository without downloading any objects. It shows branches, tags, and their commit hashes, useful for checking remote state before fetching.
The command queries the remote directly, showing current refs at query time. This enables checking tag existence, verifying branch status, or scripting against remote repository state. It works with both named remotes and direct URLs.
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)
