1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8" />
6 <meta name=
"generator" content=
"AsciiDoc 8.4.5" />
7 <title>git-notes(
1)
</title>
8 <style type=
"text/css">
10 p
, li
, dt
, dd
, div
, pre
, h1
, h2
, h3
, h4
, h5
, h6
{
12 border: 1px solid red;
17 margin: 1em 5% 1em 5%;
22 text-decoration: underline
;
42 h1
, h2
, h3
, h4
, h5
, h6
{
44 font-family: sans-serif
;
51 border-bottom: 2px solid silver
;
69 border: 1px solid silver
;
88 font-family: sans-serif
;
94 span#revnumber
, span#revdate
, span#revremark
{
95 font-family: sans-serif
;
99 font-family: sans-serif
;
101 border-top: 2px solid silver
;
107 padding-bottom: 0.5em;
111 padding-bottom: 0.5em;
116 margin-bottom: 1.5em;
118 div
.tableblock
, div
.imageblock
, div
.exampleblock
, div
.verseblock
,
119 div
.quoteblock
, div
.literalblock
, div
.listingblock
, div
.sidebarblock
,
120 div
.admonitionblock
{
122 margin-bottom: 1.5em;
124 div
.admonitionblock
{
126 margin-bottom: 2.5em;
129 div
.content
{ /* Block element content. */
133 /* Block element titles. */
134 div
.title
, caption
.title
{
136 font-family: sans-serif
;
140 margin-bottom: 0.5em;
146 td div
.title:first-child
{
149 div
.content div
.title:first-child
{
152 div
.content
+ div
.title
{
156 div
.sidebarblock
> div
.content
{
158 border: 1px solid silver
;
162 div
.listingblock
> div
.content
{
163 border: 1px solid silver
;
172 div
.quoteblock
> div
.attribution
{
181 div
.verseblock
> div
.content
{
184 div
.verseblock
> div
.attribution
{
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div
.verseblock
+ div
.attribution
{
193 div
.admonitionblock
.icon
{
197 text-decoration: underline
;
199 padding-right: 0.5em;
201 div
.admonitionblock td
.content
{
203 border-left: 2px solid silver
;
206 div
.exampleblock
> div
.content
{
207 border-left: 2px solid silver
;
211 div
.imageblock div
.content
{ padding-left: 0; }
212 span
.image img
{ border-style: none
; }
213 a
.image:visited
{ color: white
; }
217 margin-bottom: 0.8em;
230 list-style-position: outside
;
233 list-style-type: decimal
;
236 list-style-type: lower-alpha
;
239 list-style-type: upper-alpha
;
242 list-style-type: lower-roman
;
245 list-style-type: upper-roman
;
248 div
.compact ul
, div
.compact ol
,
249 div
.compact p
, div
.compact p
,
250 div
.compact div
, div
.compact div
{
252 margin-bottom: 0.1em;
255 div
.tableblock
> table
{
256 border: 3px solid
#527bbd;
259 font-family: sans-serif
;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div
.tableblock
> table
[frame
="void"] {
275 div
.tableblock
> table
[frame
="hsides"] {
276 border-left-style: none
;
277 border-right-style: none
;
279 div
.tableblock
> table
[frame
="vsides"] {
280 border-top-style: none
;
281 border-bottom-style: none
;
287 margin-bottom: 0.8em;
290 padding-bottom: 15px;
292 dt
.hdlist1
.strong
, td
.hdlist1
.strong
{
298 padding-right: 0.8em;
304 div
.hdlist
.compact tr
{
314 div#footer-badges
{ display: none
; }
319 font-family: sans-serif
;
323 margin-bottom: 0.1em;
326 div
.toclevel1
, div
.toclevel2
, div
.toclevel3
, div
.toclevel4
{
342 /* Overrides for manpage documents */
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver
;
347 border-bottom: 2px solid silver
;
357 div#toc
{ display: none
; }
360 /* Workarounds for IE6's broken and incomplete CSS2. */
362 div
.sidebar-content
{
364 border: 1px solid silver
;
367 div
.sidebar-title
, div
.image-title
{
369 font-family: sans-serif
;
372 margin-bottom: 0.5em;
375 div
.listingblock div
.content
{
376 border: 1px solid silver
;
381 div
.quoteblock-attribution
{
386 div
.verseblock-content
{
389 div
.verseblock-attribution
{
394 div
.exampleblock-content
{
395 border-left: 2px solid silver
;
399 /* IE6 sets dynamically generated links as visited. */
400 div#toc
a:visited
{ color: blue
; }
406 git-notes(
1) Manual Page
409 <div class=
"sectionbody">
411 Add or inspect object notes
415 <h2 id=
"_synopsis">SYNOPSIS
</h2>
416 <div class=
"sectionbody">
417 <div class=
"verseblock">
418 <div class=
"verseblock-content"><em>git notes
</em> [list [
<object
>]]
419 <em>git notes
</em> add [-f] [-F
<file
> | -m
<msg
> | (-c | -C)
<object
>] [
<object
>]
420 <em>git notes
</em> copy [-f] ( --stdin |
<from-object
> <to-object
> )
421 <em>git notes
</em> append [-F
<file
> | -m
<msg
> | (-c | -C)
<object
>] [
<object
>]
422 <em>git notes
</em> edit [
<object
>]
423 <em>git notes
</em> show [
<object
>]
424 <em>git notes
</em> merge [-v | -q] [-s
<strategy
> ]
<notes_ref
>
425 <em>git notes
</em> merge --commit [-v | -q]
426 <em>git notes
</em> merge --abort [-v | -q]
427 <em>git notes
</em> remove [--ignore-missing] [--stdin] [
<object
>…]
428 <em>git notes
</em> prune [-n | -v]
429 <em>git notes
</em> get-ref
</div>
430 <div class=
"verseblock-attribution">
433 <h2 id=
"_description">DESCRIPTION
</h2>
434 <div class=
"sectionbody">
435 <div class=
"paragraph"><p>Adds, removes, or reads notes attached to objects, without touching
436 the objects themselves.
</p></div>
437 <div class=
"paragraph"><p>By default, notes are saved to and read from
<tt>refs/notes/commits
</tt>, but
438 this default can be overridden. See the OPTIONS, CONFIGURATION, and
439 ENVIRONMENT sections below. If this ref does not exist, it will be
440 quietly created when it is first needed to store a note.
</p></div>
441 <div class=
"paragraph"><p>A typical use of notes is to supplement a commit message without
442 changing the commit itself. Notes can be shown by
<em>git log
</em> along with
443 the original commit message. To distinguish these notes from the
444 message stored in the commit object, the notes are indented like the
445 message, after an unindented line saying
"Notes (<refname>):" (or
446 "Notes:" for
<tt>refs/notes/commits
</tt>).
</p></div>
447 <div class=
"paragraph"><p>To change which notes are shown by
<em>git log
</em>, see the
448 "notes.displayRef" configuration in
<a href=
"git-log.html">git-log(
1)
</a>.
</p></div>
449 <div class=
"paragraph"><p>See the
"notes.rewrite.<command>" configuration for a way to carry
450 notes across commands that rewrite commits.
</p></div>
452 <h2 id=
"_subcommands">SUBCOMMANDS
</h2>
453 <div class=
"sectionbody">
454 <div class=
"dlist"><dl>
460 List the notes object for a given object. If no object is
461 given, show a list of all note objects and the objects they
462 annotate (in the format
"<note object> <annotated object>").
463 This is the default subcommand if no subcommand is given.
471 Add notes for a given object (defaults to HEAD). Abort if the
472 object already has notes (use
<tt>-f
</tt> to overwrite existing notes).
473 However, if you
’re using
<tt>add
</tt> interactively (using an editor
474 to supply the notes contents), then - instead of aborting -
475 the existing notes will be opened in the editor (like the
<tt>edit
</tt>
484 Copy the notes for the first object onto the second object.
485 Abort if the second object already has notes, or if the first
486 object has none (use -f to overwrite existing notes to the
487 second object). This subcommand is equivalent to:
488 <tt>git notes add [-f] -C $(git notes list
<from-object
>)
<to-object
></tt>
490 <div class=
"paragraph"><p>In
<tt>--stdin
</tt> mode, take lines in the format
</p></div>
491 <div class=
"listingblock">
492 <div class=
"content">
493 <pre><tt><from-object
> SP
<to-object
> [ SP
<rest
> ] LF
</tt></pre>
495 <div class=
"paragraph"><p>on standard input, and copy the notes from each
<from-object
> to its
496 corresponding
<to-object
>. (The optional
<tt><rest
></tt> is ignored so that
497 the command can read the input given to the
<tt>post-rewrite
</tt> hook.)
</p></div>
504 Append to the notes of an existing object (defaults to HEAD).
505 Creates a new notes object if needed.
513 Edit the notes for a given object (defaults to HEAD).
521 Show the notes for a given object (defaults to HEAD).
529 Merge the given notes ref into the current notes ref.
530 This will try to merge the changes made by the given
531 notes ref (called
"remote") since the merge-base (if
532 any) into the current notes ref (called
"local").
534 <div class=
"paragraph"><p>If conflicts arise and a strategy for automatically resolving
535 conflicting notes (see the -s/--strategy option) is not given,
536 the
"manual" resolver is used. This resolver checks out the
537 conflicting notes in a special worktree (
<tt>.git/NOTES_MERGE_WORKTREE
</tt>),
538 and instructs the user to manually resolve the conflicts there.
539 When done, the user can either finalize the merge with
540 <em>git notes merge --commit
</em>, or abort the merge with
541 <em>git notes merge --abort
</em>.
</p></div>
548 Remove the notes for given objects (defaults to HEAD). When
549 giving zero or one object from the command line, this is
550 equivalent to specifying an empty note message to
551 the
<tt>edit
</tt> subcommand.
559 Remove all notes for non-existing/unreachable objects.
567 Print the current notes ref. This provides an easy way to
568 retrieve the current notes ref (e.g. from scripts).
573 <h2 id=
"_options">OPTIONS
</h2>
574 <div class=
"sectionbody">
575 <div class=
"dlist"><dl>
584 When adding notes to an object that already has notes,
585 overwrite the existing notes (instead of aborting).
592 --message=
<msg
>
596 Use the given note message (instead of prompting).
597 If multiple
<tt>-m
</tt> options are given, their values
598 are concatenated as separate paragraphs.
599 Lines starting with
<tt>#
</tt> and empty lines other than a
600 single line between paragraphs will be stripped out.
611 Take the note message from the given file. Use
<em>-
</em> to
612 read the note message from the standard input.
613 Lines starting with
<tt>#
</tt> and empty lines other than a
614 single line between paragraphs will be stripped out.
621 --reuse-message=
<object
>
625 Take the note message from the given blob object (for
626 example, another note).
633 --reedit-message=
<object
>
637 Like
<em>-C
</em>, but with
<em>-c
</em> the editor is invoked, so that
638 the user can further edit the note message.
646 Manipulate the notes tree in
<ref
>. This overrides
647 <em>GIT_NOTES_REF
</em> and the
"core.notesRef" configuration. The ref
648 is taken to be in
<tt>refs/notes/
</tt> if it is not qualified.
656 Do not consider it an error to request removing notes from an
657 object that does not have notes attached to it.
665 Also read the object names to remove notes from from the standard
666 input (there is no reason you cannot combine this with object
667 names from the command line).
678 Do not remove anything; just report the object names whose notes
686 --strategy=
<strategy
>
690 When merging notes, resolve notes conflicts using the given
691 strategy. The following strategies are recognized:
"manual"
692 (default),
"ours",
"theirs",
"union" and
"cat_sort_uniq".
693 See the
"NOTES MERGE STRATEGIES" section below for more
694 information on each notes merge strategy.
702 Finalize an in-progress
<em>git notes merge
</em>. Use this option
703 when you have resolved the conflicts that
<em>git notes merge
</em>
704 stored in .git/NOTES_MERGE_WORKTREE. This amends the partial
705 merge commit created by
<em>git notes merge
</em> (stored in
706 .git/NOTES_MERGE_PARTIAL) by adding the notes in
707 .git/NOTES_MERGE_WORKTREE. The notes ref stored in the
708 .git/NOTES_MERGE_REF symref is updated to the resulting commit.
716 Abort/reset a in-progress
<em>git notes merge
</em>, i.e. a notes merge
717 with conflicts. This simply removes all files related to the
729 When merging notes, operate quietly.
740 When merging notes, be more verbose.
741 When pruning notes, report all object names whose notes are
747 <h2 id=
"_discussion">DISCUSSION
</h2>
748 <div class=
"sectionbody">
749 <div class=
"paragraph"><p>Commit notes are blobs containing extra information about an object
750 (usually information to supplement a commit
’s message). These blobs
751 are taken from notes refs. A notes ref is usually a branch which
752 contains
"files" whose paths are the object names for the objects
753 they describe, with some directory separators included for performance
754 reasons
<br />[Permitted pathnames have the form
755 <em>ab
</em><tt>/
</tt><em>cd
</em><tt>/
</tt><em>ef
</em><tt>/
</tt><em>…</em><tt>/
</tt><em>abcdef
…</em>: a sequence of directory
756 names of two hexadecimal digits each followed by a filename with the
757 rest of the object ID.]
<br />.
</p></div>
758 <div class=
"paragraph"><p>Every notes change creates a new commit at the specified notes ref.
759 You can therefore inspect the history of the notes by invoking, e.g.,
760 <tt>git log -p notes/commits
</tt>. Currently the commit message only records
761 which operation triggered the update, and the commit authorship is
762 determined according to the usual rules (see
<a href=
"git-commit.html">git-commit(
1)
</a>).
763 These details may change in the future.
</p></div>
764 <div class=
"paragraph"><p>It is also permitted for a notes ref to point directly to a tree
765 object, in which case the history of the notes can be read with
766 <tt>git log -p -g
<refname
></tt>.
</p></div>
768 <h2 id=
"_notes_merge_strategies">NOTES MERGE STRATEGIES
</h2>
769 <div class=
"sectionbody">
770 <div class=
"paragraph"><p>The default notes merge strategy is
"manual", which checks out
771 conflicting notes in a special work tree for resolving notes conflicts
772 (
<tt>.git/NOTES_MERGE_WORKTREE
</tt>), and instructs the user to resolve the
773 conflicts in that work tree.
774 When done, the user can either finalize the merge with
775 <em>git notes merge --commit
</em>, or abort the merge with
776 <em>git notes merge --abort
</em>.
</p></div>
777 <div class=
"paragraph"><p>"ours" automatically resolves conflicting notes in favor of the local
778 version (i.e. the current notes ref).
</p></div>
779 <div class=
"paragraph"><p>"theirs" automatically resolves notes conflicts in favor of the remote
780 version (i.e. the given notes ref being merged into the current notes
782 <div class=
"paragraph"><p>"union" automatically resolves notes conflicts by concatenating the
783 local and remote versions.
</p></div>
784 <div class=
"paragraph"><p>"cat_sort_uniq" is similar to
"union", but in addition to concatenating
785 the local and remote versions, this strategy also sorts the resulting
786 lines, and removes duplicate lines from the result. This is equivalent
787 to applying the
"cat | sort | uniq" shell pipeline to the local and
788 remote versions. This strategy is useful if the notes follow a line-based
789 format where one wants to avoid duplicated lines in the merge result.
790 Note that if either the local or remote version contain duplicate lines
791 prior to the merge, these will also be removed by this notes merge
794 <h2 id=
"_examples">EXAMPLES
</h2>
795 <div class=
"sectionbody">
796 <div class=
"paragraph"><p>You can use notes to add annotations with information that was not
797 available at the time a commit was written.
</p></div>
798 <div class=
"listingblock">
799 <div class=
"content">
800 <pre><tt>$ git notes add -m 'Tested-by: Johannes Sixt
<j6t@kdbg.org
>'
72a144e2
801 $ git show -s
72a144e
803 Signed-off-by: Junio C Hamano
<gitster@pobox.com
>
806 Tested-by: Johannes Sixt
<j6t@kdbg.org
></tt></pre>
808 <div class=
"paragraph"><p>In principle, a note is a regular Git blob, and any kind of
809 (non-)format is accepted. You can binary-safely create notes from
810 arbitrary files using
<em>git hash-object
</em>:
</p></div>
811 <div class=
"listingblock">
812 <div class=
"content">
814 $ blob=$(git hash-object -w a.out)
815 $ git notes --ref=built add -C
"$blob" HEAD
</tt></pre>
817 <div class=
"paragraph"><p>Of course, it doesn
’t make much sense to display non-text-format notes
818 with
<em>git log
</em>, so if you use such notes, you
’ll probably need to write
819 some special-purpose tools to do something useful with them.
</p></div>
821 <h2 id=
"_configuration">CONFIGURATION
</h2>
822 <div class=
"sectionbody">
823 <div class=
"dlist"><dl>
829 Notes ref to read and manipulate instead of
830 <tt>refs/notes/commits
</tt>. Must be an unabbreviated ref name.
831 This setting can be overridden through the environment and
840 Which ref (or refs, if a glob or specified more than once), in
841 addition to the default set by
<tt>core.notesRef
</tt> or
842 <em>GIT_NOTES_REF
</em>, to read notes from when showing commit
843 messages with the
<em>git log
</em> family of commands.
844 This setting can be overridden on the command line or by the
845 <em>GIT_NOTES_DISPLAY_REF
</em> environment variable.
846 See
<a href=
"git-log.html">git-log(
1)
</a>.
850 notes.rewrite.
<command
>
854 When rewriting commits with
<command
> (currently
<tt>amend
</tt> or
855 <tt>rebase
</tt>), if this variable is
<tt>false
</tt>, git will not copy
856 notes from the original to the rewritten commit. Defaults to
857 <tt>true
</tt>. See also
"<tt>notes.rewriteRef</tt>" below.
859 <div class=
"paragraph"><p>This setting can be overridden by the
<em>GIT_NOTES_REWRITE_REF
</em>
860 environment variable.
</p></div>
867 When copying notes during a rewrite, what to do if the target
868 commit already has a note. Must be one of
<tt>overwrite
</tt>,
869 <tt>concatenate
</tt>, and
<tt>ignore
</tt>. Defaults to
<tt>concatenate
</tt>.
871 <div class=
"paragraph"><p>This setting can be overridden with the
<tt>GIT_NOTES_REWRITE_MODE
</tt>
872 environment variable.
</p></div>
879 When copying notes during a rewrite, specifies the (fully
880 qualified) ref whose notes should be copied. May be a glob,
881 in which case notes in all matching refs will be copied. You
882 may also specify this configuration several times.
884 <div class=
"paragraph"><p>Does not have a default value; you must configure this variable to
885 enable note rewriting.
</p></div>
886 <div class=
"paragraph"><p>Can be overridden with the
<em>GIT_NOTES_REWRITE_REF
</em> environment variable.
</p></div>
890 <h2 id=
"_environment">ENVIRONMENT
</h2>
891 <div class=
"sectionbody">
892 <div class=
"dlist"><dl>
894 <em>GIT_NOTES_REF
</em>
898 Which ref to manipulate notes from, instead of
<tt>refs/notes/commits
</tt>.
899 This overrides the
<tt>core.notesRef
</tt> setting.
903 <em>GIT_NOTES_DISPLAY_REF
</em>
907 Colon-delimited list of refs or globs indicating which refs,
908 in addition to the default from
<tt>core.notesRef
</tt> or
909 <em>GIT_NOTES_REF
</em>, to read notes from when showing commit
911 This overrides the
<tt>notes.displayRef
</tt> setting.
913 <div class=
"paragraph"><p>A warning will be issued for refs that do not exist, but a glob that
914 does not match any refs is silently ignored.
</p></div>
917 <em>GIT_NOTES_REWRITE_MODE
</em>
921 When copying notes during a rewrite, what to do if the target
922 commit already has a note.
923 Must be one of
<tt>overwrite
</tt>,
<tt>concatenate
</tt>, and
<tt>ignore
</tt>.
924 This overrides the
<tt>core.rewriteMode
</tt> setting.
928 <em>GIT_NOTES_REWRITE_REF
</em>
932 When rewriting commits, which notes to copy from the original
933 to the rewritten commit. Must be a colon-delimited list of
936 <div class=
"paragraph"><p>If not set in the environment, the list of notes to copy depends
937 on the
<tt>notes.rewrite.
<command
></tt> and
<tt>notes.rewriteRef
</tt> settings.
</p></div>
941 <h2 id=
"_author">Author
</h2>
942 <div class=
"sectionbody">
943 <div class=
"paragraph"><p>Written by Johannes Schindelin
<<a href=
"mailto:johannes.schindelin@gmx.de">johannes.schindelin@gmx.de
</a>> and
944 Johan Herland
<<a href=
"mailto:johan@herland.net">johan@herland.net
</a>></p></div>
946 <h2 id=
"_documentation">Documentation
</h2>
947 <div class=
"sectionbody">
948 <div class=
"paragraph"><p>Documentation by Johannes Schindelin and Johan Herland
</p></div>
950 <h2 id=
"_git">GIT
</h2>
951 <div class=
"sectionbody">
952 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
7)
</a> suite
</p></div>
955 <div id=
"footer-text">
956 Last updated
2011-
05-
30 08:
13:
19 UTC