git notes [list [<object>]] git notes add [-f] [-F <file> | -m <msg> | (-c | -C) <object>] [<object>] git notes copy [-f] ( --stdin | <from-object> <to-object> ) git notes append [-F <file> | -m <msg> | (-c | -C) <object>] [<object>] git notes edit [<object>] git notes show [<object>] git notes remove [<object>] git notes prune [-n | -v]
Adds, removes, or reads notes attached to objects, without touching the objects themselves.
By default, notes are saved to and read from refs/notes/commits, but this default can be overridden. See the OPTIONS, CONFIGURATION, and ENVIRONMENT sections below. If this ref does not exist, it will be quietly created when it is first needed to store a note.
A typical use of notes is to supplement a commit message without changing the commit itself. Notes can be shown by git log along with the original commit message. To distinguish these notes from the message stored in the commit object, the notes are indented like the message, after an unindented line saying "Notes (<refname>):" (or "Notes:" for refs/notes/commits).
To change which notes are shown by git log, see the "notes.displayRef" configuration in git-log(1).
See the "notes.rewrite.<command>" configuration for a way to carry notes across commands that rewrite commits.
list
add
copy
In --stdin mode, take lines in the format
<from-object> SP <to-object> [ SP <rest> ] LF
on standard input, and copy the notes from each <from-object> to its corresponding <to-object>. (The optional <rest> is ignored so that the command can read the input given to the post-rewrite hook.)
append
edit
show
remove
prune
-f, --force
-m <msg>, --message=<msg>
-F <file>, --file=<file>
-C <object>, --reuse-message=<object>
-c <object>, --reedit-message=<object>
--ref <ref>
-n, --dry-run
-v, --verbose
Commit notes are blobs containing extra information about an object (usually information to supplement a commit's message). These blobs are taken from notes refs. A notes ref is usually a branch which contains "files" whose paths are the object names for the objects they describe, with some directory separators included for performance reasons [1].
Every notes change creates a new commit at the specified notes ref. You can therefore inspect the history of the notes by invoking, e.g., git log -p notes/commits. Currently the commit message only records which operation triggered the update, and the commit authorship is determined according to the usual rules (see git-commit(1)). These details may change in the future.
It is also permitted for a notes ref to point directly to a tree object, in which case the history of the notes can be read with git log -p -g <refname>.
You can use notes to add annotations with information that was not available at the time a commit was written.
$ git notes add -m 'Tested-by: Johannes Sixt <j6t@kdbg.org>' 72a144e2 $ git show -s 72a144e [...] Signed-off-by: Junio C Hamano <gitster@pobox.com> Notes: Tested-by: Johannes Sixt <j6t@kdbg.org>
In principle, a note is a regular Git blob, and any kind of (non-)format is accepted. You can binary-safely create notes from arbitrary files using git hash-object:
$ cc *.c $ blob=$(git hash-object -w a.out) $ git notes --ref=built add -C "$blob" HEAD
Of course, it doesn't make much sense to display non-text-format notes with git log, so if you use such notes, you'll probably need to write some special-purpose tools to do something useful with them.
core.notesRef
notes.displayRef
notes.rewrite.<command>
This setting can be overridden by the GIT_NOTES_REWRITE_REF environment variable.
notes.rewriteMode
This setting can be overridden with the GIT_NOTES_REWRITE_MODE environment variable.
notes.rewriteRef
Does not have a default value; you must configure this variable to enable note rewriting.
Can be overridden with the GIT_NOTES_REWRITE_REF environment variable.
GIT_NOTES_REF
GIT_NOTES_DISPLAY_REF
A warning will be issued for refs that do not exist, but a glob that does not match any refs is silently ignored.
GIT_NOTES_REWRITE_MODE
GIT_NOTES_REWRITE_REF
If not set in the environment, the list of notes to copy depends on the notes.rewrite.<command> and notes.rewriteRef settings.
Written by Johannes Schindelin <m[blue]johannes.schindelin@gmx.dem[][2]> and Johan Herland <m[blue]johan@herland.netm[][3]>
Documentation by Johannes Schindelin and Johan Herland
Part of the git(7) suite
Permitted pathnames have the form ab/cd/ef/.../abcdef...: a sequence of directory names of two hexadecimal digits each followed by a filename with the rest of the object ID.