This command lets you attach a custom message to a commit in Git without modifying its history.
It works by creating a note object stored under refs/notes/commits
keyed by the commit’s SHA; using -m
you supply the note text directly, or you can use -F <file>
to load it from a file, and if you skip -m
Git will launch your editor.
Once added, you can inspect notes with git log --show-notes
or git notes show
. Closely related commands include git notes edit
to update a note, git notes remove
or rm
to delete one, and viewing logs with git log --notes
; you can also force overwrite with -f
, merge notes using git notes merge
, or import note content from a file via -F
.
Example:
git notes add -m 'Reviewed-by: Alice'