class Git::Commands::SymbolicRef::Read

Reads the target of a symbolic ref via ‘git symbolic-ref`

Given one argument, reads which branch head the given symbolic ref refers to and outputs its path, relative to the ‘.git/` directory.

Exits with status 0 if the contents were printed correctly, or status 1 if the requested name is not a symbolic ref (e.g. a detached HEAD). When ‘quiet: true`, exit status 1 is silent (no error message on stderr).

@example Read current HEAD

cmd = Git::Commands::SymbolicRef::Read.new(execution_context)
result = cmd.call('HEAD')
result.stdout  # => "refs/heads/main"

@example Read HEAD with shortened output

cmd = Git::Commands::SymbolicRef::Read.new(execution_context)
result = cmd.call('HEAD', short: true)
result.stdout  # => "main"

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

@see Git::Commands::SymbolicRef

@see git-scm.com/docs/git-symbolic-ref git-symbolic-ref documentation

@api private