git-notes

Add metadata to commits

TLDR

Add note to HEAD
$ git notes add -m "[note text]"
Add note to specific commit
$ git notes add -m "[note]" [commit]
Show notes for a commit
$ git notes show [commit]
List all notes
$ git notes list
Edit existing note
$ git notes edit [commit]
Append text to an existing note
$ git notes append -m "[more text]" [commit]
Copy a note from one commit to another
$ git notes copy [from_commit] [to_commit]
Remove note
$ git notes remove [commit]
Push notes to remote
$ git push origin refs/notes/*
Fetch notes from remote
$ git fetch origin refs/notes/*:refs/notes/*

SYNOPSIS

git notes [subcommand] [options]

DESCRIPTION

git notes adds metadata to commits without modifying them. Notes are stored as separate refs under refs/notes/, allowing annotations, code review comments, build status, or other metadata to be attached after commits are created and even after they have been pushed.Notes can be organized in namespaces using the --ref option. Since notes don't change commit hashes, they provide a non-destructive way to enrich commit history with additional context.The default notes ref is refs/notes/commits, but you can keep separate notes namespaces (e.g. refs/notes/review, refs/notes/build) by using --ref or by setting core.notesRef in git config.

PARAMETERS

add

Add a new note to the given object (default: HEAD). Fails if a note already exists unless -f is used.
show
Print the note for the given object.
list
List notes for the given object, or list all notes if no object is specified.
edit
Edit existing note in the configured editor.
append
Append new content to an existing note.
copy from to
Copy the note from one object to another.
remove
Remove notes for the given objects.
prune
Remove notes attached to objects that no longer exist.
merge ref
Merge notes from another notes ref.
get-ref
Print the current notes ref.
-m MSG
Use given message as the note text.
-F FILE
Read note text from a file.
-C OBJECT
Reuse note from given object.
-c OBJECT
Reuse and edit note from given object.
-f, --force
Overwrite an existing note.
--ref REF
Use the given notes ref instead of the default refs/notes/commits.

INSTALL

sudo apt install git
sudo dnf install git
sudo pacman -S git
sudo apk add git
sudo zypper install git
brew install git
nix profile install nixpkgs#git

CAVEATS

Notes are stored as separate refs and are not pushed or fetched by default. Use explicit refspecs like **refs/notes/*:refs/notes/*** to sync notes between repositories. Concurrent edits can cause notes-merge conflicts.

HISTORY

git notes was added to Git in version 1.6.6 (December 2009) to allow attaching metadata to commits without rewriting history.

SEE ALSO

git-log(1), git-commit(1), git-push(1), git-fetch(1)