git show-ref --heads

Show commit hashes and reference names for all local branches.

This command is useful for quickly verifying the commit IDs of all local branches by listing each branch ref and its associated hash.

It invokes Git’s reference listing functionality, scans the .git/refs directory, and applies the --heads flag to filter output to only refs/heads/*, then prints each SHA-1 hash followed by its full reference path.

Variations include git show-ref --tags to list tag refs, combining --heads and --tags to show both branch and tag refs, running git show-ref without flags to display all refs, using git for-each-ref refs/heads/ for custom formatting, or git branch -v for a concise branch summary.

Related commands

Welcome to GitExamples!

Sign in to enable bookmarking, reminders, progress-tracking and more...