This command is useful for retrieving the annotation stored alongside a commit by reading the notes tree and outputting the note body tied to the specified commit.
It operates by using the show
subcommand of git notes
to locate the note object under the default refs/notes/commits
ref, then prints its content. The <commit>
parameter specifies which commit’s notes to display; it accepts a full or partial SHA-1 hash, HEAD
, branch name, or any other valid commit identifier.
You can use variations like git notes list
to list all commits with notes, git notes add -m "Note text" <commit>
to create or update a note, or include notes in your history view with git log --notes
. To work with a different notes reference, add the --ref=<notes-ref>
option to any of these commands.
Examples:
git notes show 1a2b3c4
git notes show HEAD