LinuxCommandLibrary

git-symbolic-ref

Show HEAD target

TLDR

Show HEAD target

$ git symbolic-ref HEAD
copy
Set HEAD to branch
$ git symbolic-ref HEAD refs/heads/main
copy
Get short name
$ git symbolic-ref --short HEAD
copy
Delete symbolic ref
$ git symbolic-ref -d HEAD
copy

SYNOPSIS

git symbolic-ref [options] name [ref]

DESCRIPTION

git symbolic-ref reads and modifies symbolic references. HEAD is the most common symbolic ref, pointing to the current branch.
The command shows where HEAD points (which branch is checked out) or changes it. It's a plumbing command used by checkout and branch operations.
git symbolic-ref manages symbolic references like HEAD.

PARAMETERS

NAME

Symbolic ref name (usually HEAD).
REF
Target ref to set.
--short
Show short name.
-d, --delete
Delete symbolic ref.
-q, --quiet
Quiet mode.
--help
Display help information.

CAVEATS

Plumbing command. HEAD is most common use. Detached HEAD is not a symbolic ref.

HISTORY

git symbolic-ref is a core Git plumbing command for managing symbolic references, fundamental to branch tracking.

SEE ALSO

Copied to clipboard