Skip to content

Git Notes

In one line

git notes attaches extra content to existing commits via a separate ref, leaving the original commit untouched.

In simple words

git notes lets you add extra metadata to a commit without rewriting the commit itself. The note is stored in a separate ref (refs/notes/commits by default) and is associated with the commit's hash. When you log, the note appears after the commit message. This is useful for adding information that was not in the original commit.

Common uses: adding code review comments, signing-off approvals, CI build results, or bug-tracker references to commits after they are created. Because the note lives in its own ref, it can be pushed and fetched independently (git push origin refs/notes/commits), and the original commit hash is preserved.

Notes are an alternative to rewriting history with amend or filter-branch (which changes hashes and can disrupt collaborators). They keep the commit immutable while still letting you annotate. The downside is that notes are less commonly used and some tools do not display them by default.

Example

bash
# Add a note to the latest commit
git notes add -m "Reviewed-by: Ada" HEAD

# View the note in the log
git log --notes
# commit abc123...
# Author: ...
#     fix: handle null input
# Notes:
#     Reviewed-by: Ada

# Push notes to share with the team
git push origin refs/notes/commits

# Remove a note
git notes remove HEAD

notes add attaches metadata to a commit by hash. The note lives in refs/notes/commits, separate from the commit. --notes shows it in log.

Related terms

Related Resources

Related Lessons

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary