Forrest logo
back to the git tool

git-show-ref:tldr:edd7e

git-show-ref: Show only heads references.
$ git show-ref --heads
try on your machine

The command "git show-ref --heads" is used in Git to display the reference pointers that point to branch heads in your repository.

In Git, references (or refs) are pointers that point to specific commit objects within the repository's history. Branches in Git are simply references that move automatically as new commits are added.

When you run the "git show-ref --heads" command, Git will list all the branch heads in your repository. A branch head is the reference pointer that points to the latest commit on a branch.

The output of the command will typically be a list of references in the format " refs/heads/". The is the unique identifier of the latest commit on the branch, and is the name of the branch.

For example, imagine you have two branches in your repository: "master" and "feature-branch". Running "git show-ref --heads" might show an output like:

e1a75c0e6f417f55f19b1d206091b6e1b6c4b14d refs/heads/master 0f326bb52f4ad8ab095fc1d6c7af55795e8fafae refs/heads/feature-branch

This output indicates that the branch "master" is pointing to commit "e1a75c0e6f417f55f19b1d206091b6e1b6c4b14d", and the branch "feature-branch" is pointing to commit "0f326bb52f4ad8ab095fc1d6c7af55795e8fafae".

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the git tool