class Git::Commands::LsRemote

Implements the ‘git ls-remote` command

Lists references available in a remote repository along with the associated commit IDs. Can be used to detect changes in a remote repository without cloning or fetching.

@example List all refs in a remote

ls_remote = Git::Commands::LsRemote.new(execution_context)
ls_remote.call('origin')

@example List only branches and tags

ls_remote = Git::Commands::LsRemote.new(execution_context)
ls_remote.call('origin', branches: true, tags: true)

@example List only refs (no symbolic refs like HEAD)

ls_remote = Git::Commands::LsRemote.new(execution_context)
ls_remote.call('origin', refs: true)

@example Filter by pattern

ls_remote = Git::Commands::LsRemote.new(execution_context)
ls_remote.call('origin', 'refs/heads/main')

@example Detect the default branch of a remote

ls_remote = Git::Commands::LsRemote.new(execution_context)
ls_remote.call('origin', 'HEAD', symref: true)

@note ‘arguments` block audited against git-scm.com/docs/git-ls-remote/2.53.0

@see git-scm.com/docs/git-ls-remote git-ls-remote documentation

@see Git::Commands

@api private