Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 1 | git-notes(1) |
| 2 | ============ |
| 3 | |
| 4 | NAME |
| 5 | ---- |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 6 | git-notes - Add or inspect object notes |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 7 | |
| 8 | SYNOPSIS |
| 9 | -------- |
| 10 | [verse] |
Junio C Hamano | ea90ab3 | 2010-03-15 20:32:55 | [diff] [blame] | 11 | 'git notes' [list [<object>]] |
Junio C Hamano | f4e4f53 | 2024-11-02 05:48:11 | [diff] [blame] | 12 | 'git notes' add [-f] [--allow-empty] [--[no-]separator | --separator=<paragraph-break>] [--[no-]stripspace] [-F <file> | -m <msg> | (-c | -C) <object>] [-e] [<object>] |
Junio C Hamano | 8ac8a3d | 2019-11-11 04:33:46 | [diff] [blame] | 13 | 'git notes' copy [-f] ( --stdin | <from-object> [<to-object>] ) |
Junio C Hamano | f4e4f53 | 2024-11-02 05:48:11 | [diff] [blame] | 14 | 'git notes' append [--allow-empty] [--[no-]separator | --separator=<paragraph-break>] [--[no-]stripspace] [-F <file> | -m <msg> | (-c | -C) <object>] [-e] [<object>] |
Junio C Hamano | 85a5122 | 2023-07-06 19:49:58 | [diff] [blame] | 15 | 'git notes' edit [--allow-empty] [<object>] [--[no-]stripspace] |
Junio C Hamano | ea90ab3 | 2010-03-15 20:32:55 | [diff] [blame] | 16 | 'git notes' show [<object>] |
Junio C Hamano | d75148a | 2014-04-08 19:48:38 | [diff] [blame] | 17 | 'git notes' merge [-v | -q] [-s <strategy> ] <notes-ref> |
Junio C Hamano | 788eeba | 2010-12-08 22:50:43 | [diff] [blame] | 18 | 'git notes' merge --commit [-v | -q] |
| 19 | 'git notes' merge --abort [-v | -q] |
Junio C Hamano | 084228c | 2011-05-30 08:13:52 | [diff] [blame] | 20 | 'git notes' remove [--ignore-missing] [--stdin] [<object>...] |
Junio C Hamano | 912712b | 2017-12-06 18:04:01 | [diff] [blame] | 21 | 'git notes' prune [-n] [-v] |
Junio C Hamano | 788eeba | 2010-12-08 22:50:43 | [diff] [blame] | 22 | 'git notes' get-ref |
Junio C Hamano | ea90ab3 | 2010-03-15 20:32:55 | [diff] [blame] | 23 | |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 24 | |
| 25 | DESCRIPTION |
| 26 | ----------- |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 27 | Adds, removes, or reads notes attached to objects, without touching |
| 28 | the objects themselves. |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 29 | |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 30 | By default, notes are saved to and read from `refs/notes/commits`, but |
| 31 | this default can be overridden. See the OPTIONS, CONFIGURATION, and |
| 32 | ENVIRONMENT sections below. If this ref does not exist, it will be |
| 33 | quietly created when it is first needed to store a note. |
| 34 | |
| 35 | A typical use of notes is to supplement a commit message without |
| 36 | changing the commit itself. Notes can be shown by 'git log' along with |
| 37 | the original commit message. To distinguish these notes from the |
Junio C Hamano | ea90ab3 | 2010-03-15 20:32:55 | [diff] [blame] | 38 | message stored in the commit object, the notes are indented like the |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 39 | message, after an unindented line saying "Notes (<refname>):" (or |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 40 | "Notes:" for `refs/notes/commits`). |
Junio C Hamano | ea90ab3 | 2010-03-15 20:32:55 | [diff] [blame] | 41 | |
Junio C Hamano | 4eb2b9c | 2012-11-15 21:12:29 | [diff] [blame] | 42 | Notes can also be added to patches prepared with `git format-patch` by |
| 43 | using the `--notes` option. Such notes are added as a patch commentary |
| 44 | after a three dash separator line. |
| 45 | |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 46 | To change which notes are shown by 'git log', see the |
Junio C Hamano | ba8baee | 2022-09-14 20:25:23 | [diff] [blame] | 47 | "notes.displayRef" discussion in <<CONFIGURATION>>. |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 48 | |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 49 | See the "notes.rewrite.<command>" configuration for a way to carry |
| 50 | notes across commands that rewrite commits. |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 51 | |
| 52 | |
| 53 | SUBCOMMANDS |
| 54 | ----------- |
| 55 | |
Junio C Hamano | ea90ab3 | 2010-03-15 20:32:55 | [diff] [blame] | 56 | list:: |
| 57 | List the notes object for a given object. If no object is |
| 58 | given, show a list of all note objects and the objects they |
Junio C Hamano | 6546a50 | 2024-02-08 23:48:36 | [diff] [blame] | 59 | annotate (in the format "<note-object> <annotated-object>"). |
Junio C Hamano | ea90ab3 | 2010-03-15 20:32:55 | [diff] [blame] | 60 | This is the default subcommand if no subcommand is given. |
| 61 | |
| 62 | add:: |
| 63 | Add notes for a given object (defaults to HEAD). Abort if the |
Junio C Hamano | 6003346 | 2011-05-03 00:48:43 | [diff] [blame] | 64 | object already has notes (use `-f` to overwrite existing notes). |
| 65 | However, if you're using `add` interactively (using an editor |
| 66 | to supply the notes contents), then - instead of aborting - |
| 67 | the existing notes will be opened in the editor (like the `edit` |
Junio C Hamano | 85a5122 | 2023-07-06 19:49:58 | [diff] [blame] | 68 | subcommand). If you specify multiple `-m` and `-F`, a blank |
| 69 | line will be inserted between the messages. Use the `--separator` |
Junio C Hamano | f4e4f53 | 2024-11-02 05:48:11 | [diff] [blame] | 70 | option to insert other delimiters. You can use `-e` to edit and |
| 71 | fine-tune the message(s) supplied from `-m` and `-F` options |
| 72 | interactively (using an editor) before adding the note. |
Junio C Hamano | ea90ab3 | 2010-03-15 20:32:55 | [diff] [blame] | 73 | |
| 74 | copy:: |
Junio C Hamano | 8ac8a3d | 2019-11-11 04:33:46 | [diff] [blame] | 75 | Copy the notes for the first object onto the second object (defaults to |
| 76 | HEAD). Abort if the second object already has notes, or if the first |
Junio C Hamano | ea90ab3 | 2010-03-15 20:32:55 | [diff] [blame] | 77 | object has none (use -f to overwrite existing notes to the |
| 78 | second object). This subcommand is equivalent to: |
| 79 | `git notes add [-f] -C $(git notes list <from-object>) <to-object>` |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 80 | + |
Junio C Hamano | b76a686 | 2012-05-02 22:02:46 | [diff] [blame] | 81 | In `--stdin` mode, take lines in the format |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 82 | + |
| 83 | ---------- |
| 84 | <from-object> SP <to-object> [ SP <rest> ] LF |
| 85 | ---------- |
| 86 | + |
| 87 | on standard input, and copy the notes from each <from-object> to its |
| 88 | corresponding <to-object>. (The optional `<rest>` is ignored so that |
| 89 | the command can read the input given to the `post-rewrite` hook.) |
Junio C Hamano | ea90ab3 | 2010-03-15 20:32:55 | [diff] [blame] | 90 | |
| 91 | append:: |
Junio C Hamano | 85a5122 | 2023-07-06 19:49:58 | [diff] [blame] | 92 | Append new message(s) given by `-m` or `-F` options to an |
| 93 | existing note, or add them as a new note if one does not |
| 94 | exist, for the object (defaults to HEAD). When appending to |
| 95 | an existing note, a blank line is added before each new |
| 96 | message as an inter-paragraph separator. The separator can |
| 97 | be customized with the `--separator` option. |
Junio C Hamano | f4e4f53 | 2024-11-02 05:48:11 | [diff] [blame] | 98 | Edit the notes to be appended given by `-m` and `-F` options with |
| 99 | `-e` interactively (using an editor) before appending the note. |
Junio C Hamano | ea90ab3 | 2010-03-15 20:32:55 | [diff] [blame] | 100 | |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 101 | edit:: |
Junio C Hamano | ea90ab3 | 2010-03-15 20:32:55 | [diff] [blame] | 102 | Edit the notes for a given object (defaults to HEAD). |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 103 | |
| 104 | show:: |
Junio C Hamano | ea90ab3 | 2010-03-15 20:32:55 | [diff] [blame] | 105 | Show the notes for a given object (defaults to HEAD). |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 106 | |
Junio C Hamano | 788eeba | 2010-12-08 22:50:43 | [diff] [blame] | 107 | merge:: |
| 108 | Merge the given notes ref into the current notes ref. |
| 109 | This will try to merge the changes made by the given |
| 110 | notes ref (called "remote") since the merge-base (if |
| 111 | any) into the current notes ref (called "local"). |
| 112 | + |
| 113 | If conflicts arise and a strategy for automatically resolving |
Junio C Hamano | 3891e25 | 2015-08-31 23:06:13 | [diff] [blame] | 114 | conflicting notes (see the "NOTES MERGE STRATEGIES" section) is not given, |
Junio C Hamano | 788eeba | 2010-12-08 22:50:43 | [diff] [blame] | 115 | the "manual" resolver is used. This resolver checks out the |
| 116 | conflicting notes in a special worktree (`.git/NOTES_MERGE_WORKTREE`), |
| 117 | and instructs the user to manually resolve the conflicts there. |
| 118 | When done, the user can either finalize the merge with |
| 119 | 'git notes merge --commit', or abort the merge with |
| 120 | 'git notes merge --abort'. |
| 121 | |
Junio C Hamano | ea90ab3 | 2010-03-15 20:32:55 | [diff] [blame] | 122 | remove:: |
Junio C Hamano | 084228c | 2011-05-30 08:13:52 | [diff] [blame] | 123 | Remove the notes for given objects (defaults to HEAD). When |
| 124 | giving zero or one object from the command line, this is |
| 125 | equivalent to specifying an empty note message to |
Junio C Hamano | ea90ab3 | 2010-03-15 20:32:55 | [diff] [blame] | 126 | the `edit` subcommand. |
| 127 | |
| 128 | prune:: |
| 129 | Remove all notes for non-existing/unreachable objects. |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 130 | |
Junio C Hamano | 788eeba | 2010-12-08 22:50:43 | [diff] [blame] | 131 | get-ref:: |
| 132 | Print the current notes ref. This provides an easy way to |
| 133 | retrieve the current notes ref (e.g. from scripts). |
| 134 | |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 135 | OPTIONS |
| 136 | ------- |
Junio C Hamano | ea90ab3 | 2010-03-15 20:32:55 | [diff] [blame] | 137 | -f:: |
| 138 | --force:: |
| 139 | When adding notes to an object that already has notes, |
| 140 | overwrite the existing notes (instead of aborting). |
| 141 | |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 142 | -m <msg>:: |
Junio C Hamano | ea90ab3 | 2010-03-15 20:32:55 | [diff] [blame] | 143 | --message=<msg>:: |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 144 | Use the given note message (instead of prompting). |
Junio C Hamano | ea90ab3 | 2010-03-15 20:32:55 | [diff] [blame] | 145 | If multiple `-m` options are given, their values |
| 146 | are concatenated as separate paragraphs. |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 147 | Lines starting with `#` and empty lines other than a |
Junio C Hamano | 6018d90 | 2023-08-18 00:20:22 | [diff] [blame] | 148 | single line between paragraphs will be stripped out. |
| 149 | If you wish to keep them verbatim, use `--no-stripspace`. |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 150 | |
| 151 | -F <file>:: |
Junio C Hamano | ea90ab3 | 2010-03-15 20:32:55 | [diff] [blame] | 152 | --file=<file>:: |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 153 | Take the note message from the given file. Use '-' to |
| 154 | read the note message from the standard input. |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 155 | Lines starting with `#` and empty lines other than a |
Junio C Hamano | 6018d90 | 2023-08-18 00:20:22 | [diff] [blame] | 156 | single line between paragraphs will be stripped out. |
| 157 | If you wish to keep them verbatim, use `--no-stripspace`. |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 158 | |
Junio C Hamano | ea90ab3 | 2010-03-15 20:32:55 | [diff] [blame] | 159 | -C <object>:: |
| 160 | --reuse-message=<object>:: |
Junio C Hamano | 6b7d215 | 2019-04-16 12:51:15 | [diff] [blame] | 161 | Take the given blob object (for example, another note) as the |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 162 | note message. (Use `git notes copy <object>` instead to |
Junio C Hamano | 85a5122 | 2023-07-06 19:49:58 | [diff] [blame] | 163 | copy notes between objects.). By default, message will be |
| 164 | copied verbatim, but if you wish to strip out the lines |
| 165 | starting with `#` and empty lines other than a single line |
| 166 | between paragraphs, use with`--stripspace` option. |
Junio C Hamano | ea90ab3 | 2010-03-15 20:32:55 | [diff] [blame] | 167 | |
| 168 | -c <object>:: |
| 169 | --reedit-message=<object>:: |
Junio C Hamano | 92d8037 | 2016-07-13 22:00:05 | [diff] [blame] | 170 | Like '-C', but with `-c` the editor is invoked, so that |
Junio C Hamano | ea90ab3 | 2010-03-15 20:32:55 | [diff] [blame] | 171 | the user can further edit the note message. |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 172 | |
Junio C Hamano | fad8412 | 2014-12-05 23:38:06 | [diff] [blame] | 173 | --allow-empty:: |
| 174 | Allow an empty note object to be stored. The default behavior is |
| 175 | to automatically remove empty notes. |
| 176 | |
Junio C Hamano | 85a5122 | 2023-07-06 19:49:58 | [diff] [blame] | 177 | --[no-]separator, --separator=<paragraph-break>:: |
| 178 | Specify a string used as a custom inter-paragraph separator |
| 179 | (a newline is added at the end as needed). If `--no-separator`, no |
| 180 | separators will be added between paragraphs. Defaults to a blank |
| 181 | line. |
| 182 | |
| 183 | --[no-]stripspace:: |
| 184 | Strip leading and trailing whitespace from the note message. |
| 185 | Also strip out empty lines other than a single line between |
Junio C Hamano | 6018d90 | 2023-08-18 00:20:22 | [diff] [blame] | 186 | paragraphs. Lines starting with `#` will be stripped out |
| 187 | in non-editor cases like `-m`, `-F` and `-C`, but not in |
| 188 | editor case like `git notes edit`, `-c`, etc. |
Junio C Hamano | 85a5122 | 2023-07-06 19:49:58 | [diff] [blame] | 189 | |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 190 | --ref <ref>:: |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 191 | Manipulate the notes tree in <ref>. This overrides |
Junio C Hamano | 042f214 | 2016-06-27 18:05:05 | [diff] [blame] | 192 | `GIT_NOTES_REF` and the "core.notesRef" configuration. The ref |
Junio C Hamano | 1f7c4a5 | 2015-10-14 22:15:51 | [diff] [blame] | 193 | specifies the full refname when it begins with `refs/notes/`; when it |
| 194 | begins with `notes/`, `refs/` and otherwise `refs/notes/` is prefixed |
| 195 | to form a full name of the ref. |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 196 | |
Junio C Hamano | 084228c | 2011-05-30 08:13:52 | [diff] [blame] | 197 | --ignore-missing:: |
| 198 | Do not consider it an error to request removing notes from an |
| 199 | object that does not have notes attached to it. |
| 200 | |
| 201 | --stdin:: |
Junio C Hamano | d4bbec0 | 2017-09-25 07:24:53 | [diff] [blame] | 202 | Also read the object names to remove notes from the standard |
Junio C Hamano | 084228c | 2011-05-30 08:13:52 | [diff] [blame] | 203 | input (there is no reason you cannot combine this with object |
| 204 | names from the command line). |
| 205 | |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 206 | -n:: |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 207 | --dry-run:: |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 208 | Do not remove anything; just report the object names whose notes |
| 209 | would be removed. |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 210 | |
Junio C Hamano | 788eeba | 2010-12-08 22:50:43 | [diff] [blame] | 211 | -s <strategy>:: |
| 212 | --strategy=<strategy>:: |
| 213 | When merging notes, resolve notes conflicts using the given |
| 214 | strategy. The following strategies are recognized: "manual" |
| 215 | (default), "ours", "theirs", "union" and "cat_sort_uniq". |
Junio C Hamano | 3891e25 | 2015-08-31 23:06:13 | [diff] [blame] | 216 | This option overrides the "notes.mergeStrategy" configuration setting. |
Junio C Hamano | 788eeba | 2010-12-08 22:50:43 | [diff] [blame] | 217 | See the "NOTES MERGE STRATEGIES" section below for more |
| 218 | information on each notes merge strategy. |
| 219 | |
| 220 | --commit:: |
| 221 | Finalize an in-progress 'git notes merge'. Use this option |
| 222 | when you have resolved the conflicts that 'git notes merge' |
| 223 | stored in .git/NOTES_MERGE_WORKTREE. This amends the partial |
| 224 | merge commit created by 'git notes merge' (stored in |
| 225 | .git/NOTES_MERGE_PARTIAL) by adding the notes in |
| 226 | .git/NOTES_MERGE_WORKTREE. The notes ref stored in the |
| 227 | .git/NOTES_MERGE_REF symref is updated to the resulting commit. |
| 228 | |
| 229 | --abort:: |
Junio C Hamano | ea1ac8d | 2018-07-18 20:16:48 | [diff] [blame] | 230 | Abort/reset an in-progress 'git notes merge', i.e. a notes merge |
Junio C Hamano | 788eeba | 2010-12-08 22:50:43 | [diff] [blame] | 231 | with conflicts. This simply removes all files related to the |
| 232 | notes merge. |
| 233 | |
| 234 | -q:: |
| 235 | --quiet:: |
| 236 | When merging notes, operate quietly. |
| 237 | |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 238 | -v:: |
Junio C Hamano | e85e36f | 2010-08-10 05:30:14 | [diff] [blame] | 239 | --verbose:: |
Junio C Hamano | 788eeba | 2010-12-08 22:50:43 | [diff] [blame] | 240 | When merging notes, be more verbose. |
| 241 | When pruning notes, report all object names whose notes are |
| 242 | removed. |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 243 | |
| 244 | |
| 245 | DISCUSSION |
| 246 | ---------- |
| 247 | |
| 248 | Commit notes are blobs containing extra information about an object |
| 249 | (usually information to supplement a commit's message). These blobs |
| 250 | are taken from notes refs. A notes ref is usually a branch which |
| 251 | contains "files" whose paths are the object names for the objects |
| 252 | they describe, with some directory separators included for performance |
| 253 | reasons footnote:[Permitted pathnames have the form |
Junio C Hamano | c9dd642 | 2020-08-10 23:32:55 | [diff] [blame] | 254 | 'bf'`/`'fe'`/`'30'`/`'...'`/`'680d5a...': a sequence of directory |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 255 | names of two hexadecimal digits each followed by a filename with the |
| 256 | rest of the object ID.]. |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 257 | |
| 258 | Every notes change creates a new commit at the specified notes ref. |
| 259 | You can therefore inspect the history of the notes by invoking, e.g., |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 260 | `git log -p notes/commits`. Currently the commit message only records |
| 261 | which operation triggered the update, and the commit authorship is |
| 262 | determined according to the usual rules (see linkgit:git-commit[1]). |
| 263 | These details may change in the future. |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 264 | |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 265 | It is also permitted for a notes ref to point directly to a tree |
| 266 | object, in which case the history of the notes can be read with |
| 267 | `git log -p -g <refname>`. |
| 268 | |
| 269 | |
Junio C Hamano | 788eeba | 2010-12-08 22:50:43 | [diff] [blame] | 270 | NOTES MERGE STRATEGIES |
| 271 | ---------------------- |
| 272 | |
| 273 | The default notes merge strategy is "manual", which checks out |
| 274 | conflicting notes in a special work tree for resolving notes conflicts |
| 275 | (`.git/NOTES_MERGE_WORKTREE`), and instructs the user to resolve the |
| 276 | conflicts in that work tree. |
| 277 | When done, the user can either finalize the merge with |
| 278 | 'git notes merge --commit', or abort the merge with |
| 279 | 'git notes merge --abort'. |
| 280 | |
Junio C Hamano | 3891e25 | 2015-08-31 23:06:13 | [diff] [blame] | 281 | Users may select an automated merge strategy from among the following using |
| 282 | either -s/--strategy option or configuring notes.mergeStrategy accordingly: |
| 283 | |
Junio C Hamano | 788eeba | 2010-12-08 22:50:43 | [diff] [blame] | 284 | "ours" automatically resolves conflicting notes in favor of the local |
| 285 | version (i.e. the current notes ref). |
| 286 | |
| 287 | "theirs" automatically resolves notes conflicts in favor of the remote |
| 288 | version (i.e. the given notes ref being merged into the current notes |
| 289 | ref). |
| 290 | |
| 291 | "union" automatically resolves notes conflicts by concatenating the |
| 292 | local and remote versions. |
| 293 | |
| 294 | "cat_sort_uniq" is similar to "union", but in addition to concatenating |
| 295 | the local and remote versions, this strategy also sorts the resulting |
| 296 | lines, and removes duplicate lines from the result. This is equivalent |
| 297 | to applying the "cat | sort | uniq" shell pipeline to the local and |
| 298 | remote versions. This strategy is useful if the notes follow a line-based |
| 299 | format where one wants to avoid duplicated lines in the merge result. |
| 300 | Note that if either the local or remote version contain duplicate lines |
| 301 | prior to the merge, these will also be removed by this notes merge |
| 302 | strategy. |
| 303 | |
| 304 | |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 305 | EXAMPLES |
| 306 | -------- |
| 307 | |
| 308 | You can use notes to add annotations with information that was not |
| 309 | available at the time a commit was written. |
| 310 | |
| 311 | ------------ |
| 312 | $ git notes add -m 'Tested-by: Johannes Sixt <j6t@kdbg.org>' 72a144e2 |
| 313 | $ git show -s 72a144e |
| 314 | [...] |
| 315 | Signed-off-by: Junio C Hamano <gitster@pobox.com> |
| 316 | |
| 317 | Notes: |
| 318 | Tested-by: Johannes Sixt <j6t@kdbg.org> |
| 319 | ------------ |
| 320 | |
| 321 | In principle, a note is a regular Git blob, and any kind of |
| 322 | (non-)format is accepted. You can binary-safely create notes from |
| 323 | arbitrary files using 'git hash-object': |
| 324 | |
| 325 | ------------ |
| 326 | $ cc *.c |
| 327 | $ blob=$(git hash-object -w a.out) |
Junio C Hamano | fad8412 | 2014-12-05 23:38:06 | [diff] [blame] | 328 | $ git notes --ref=built add --allow-empty -C "$blob" HEAD |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 329 | ------------ |
| 330 | |
Junio C Hamano | 7bd050f | 2011-09-22 06:32:22 | [diff] [blame] | 331 | (You cannot simply use `git notes --ref=built add -F a.out HEAD` |
| 332 | because that is not binary-safe.) |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 333 | Of course, it doesn't make much sense to display non-text-format notes |
| 334 | with 'git log', so if you use such notes, you'll probably need to write |
| 335 | some special-purpose tools to do something useful with them. |
| 336 | |
| 337 | |
Junio C Hamano | ba8baee | 2022-09-14 20:25:23 | [diff] [blame] | 338 | [[CONFIGURATION]] |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 339 | CONFIGURATION |
| 340 | ------------- |
| 341 | |
| 342 | core.notesRef:: |
| 343 | Notes ref to read and manipulate instead of |
| 344 | `refs/notes/commits`. Must be an unabbreviated ref name. |
| 345 | This setting can be overridden through the environment and |
| 346 | command line. |
| 347 | |
Junio C Hamano | ba8baee | 2022-09-14 20:25:23 | [diff] [blame] | 348 | include::includes/cmd-config-section-rest.txt[] |
Junio C Hamano | 3891e25 | 2015-08-31 23:06:13 | [diff] [blame] | 349 | |
Junio C Hamano | ba8baee | 2022-09-14 20:25:23 | [diff] [blame] | 350 | include::config/notes.txt[] |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 351 | |
| 352 | |
| 353 | ENVIRONMENT |
| 354 | ----------- |
| 355 | |
Junio C Hamano | 042f214 | 2016-06-27 18:05:05 | [diff] [blame] | 356 | `GIT_NOTES_REF`:: |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 357 | Which ref to manipulate notes from, instead of `refs/notes/commits`. |
| 358 | This overrides the `core.notesRef` setting. |
| 359 | |
Junio C Hamano | 042f214 | 2016-06-27 18:05:05 | [diff] [blame] | 360 | `GIT_NOTES_DISPLAY_REF`:: |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 361 | Colon-delimited list of refs or globs indicating which refs, |
| 362 | in addition to the default from `core.notesRef` or |
Junio C Hamano | 042f214 | 2016-06-27 18:05:05 | [diff] [blame] | 363 | `GIT_NOTES_REF`, to read notes from when showing commit |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 364 | messages. |
| 365 | This overrides the `notes.displayRef` setting. |
| 366 | + |
| 367 | A warning will be issued for refs that do not exist, but a glob that |
| 368 | does not match any refs is silently ignored. |
| 369 | |
Junio C Hamano | 042f214 | 2016-06-27 18:05:05 | [diff] [blame] | 370 | `GIT_NOTES_REWRITE_MODE`:: |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 371 | When copying notes during a rewrite, what to do if the target |
| 372 | commit already has a note. |
Junio C Hamano | 3891e25 | 2015-08-31 23:06:13 | [diff] [blame] | 373 | Must be one of `overwrite`, `concatenate`, `cat_sort_uniq`, or `ignore`. |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 374 | This overrides the `core.rewriteMode` setting. |
| 375 | |
Junio C Hamano | 042f214 | 2016-06-27 18:05:05 | [diff] [blame] | 376 | `GIT_NOTES_REWRITE_REF`:: |
Junio C Hamano | a574a09 | 2010-06-13 19:57:10 | [diff] [blame] | 377 | When rewriting commits, which notes to copy from the original |
| 378 | to the rewritten commit. Must be a colon-delimited list of |
| 379 | refs or globs. |
| 380 | + |
| 381 | If not set in the environment, the list of notes to copy depends |
| 382 | on the `notes.rewrite.<command>` and `notes.rewriteRef` settings. |
Junio C Hamano | 3166736 | 2010-03-25 00:38:53 | [diff] [blame] | 383 | |
Junio C Hamano | 3b70d3c | 2009-11-21 17:37:37 | [diff] [blame] | 384 | GIT |
| 385 | --- |
Junio C Hamano | 198b1f1 | 2016-05-17 22:27:24 | [diff] [blame] | 386 | Part of the linkgit:git[1] suite |