Home Explore Blog CI



git

2nd chunk of `Documentation/git-notes.adoc`
3cc722ac3b7ec683184972e5bbe68976a61d9d7e609d7a330000000100000fa0
 (defaults to
	`HEAD`). Abort if the second object already has notes, or if the first
	object has none (use `-f` to overwrite existing notes to the
	second object). This subcommand is equivalent to:
	`git notes add [-f] -C $(git notes list <from-object>) <to-object>`
+
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.)
+
`--stdin` cannot be combined with object names given on the command
line.

`append`::
	Append new message(s) given by `-m` or `-F` options to an
	existing note, or add them as a new note if one does not
	exist, for the object (defaults to `HEAD`).  When appending to
	an existing note, a blank line is added before each new
	message as an inter-paragraph separator.  The separator can
	be customized with the `--separator` option.
	Edit the notes to be appended given by `-m` and `-F` options with
	`-e` interactively (using an editor) before appending the note.

`edit`::
	Edit the notes for a given object (defaults to `HEAD`).

`show`::
	Show the notes for a given object (defaults to `HEAD`).

`merge`::
	Merge the given notes ref into the current notes ref.
	This will try to merge the changes made by the given
	notes ref (called "remote") since the merge-base (if
	any) into the current notes ref (called "local").
+
If conflicts arise and a strategy for automatically resolving
conflicting notes (see the "NOTES MERGE STRATEGIES" section) is not given,
the `manual` resolver is used. This resolver checks out the
conflicting notes in a special worktree (`.git/NOTES_MERGE_WORKTREE`),
and instructs the user to manually resolve the conflicts there.
When done, the user can either finalize the merge with
`git notes merge --commit`, or abort the merge with
`git notes merge --abort`.

`remove`::
	Remove the notes for given objects (defaults to `HEAD`). When
	giving zero or one object from the command line, this is
	equivalent to specifying an empty note message to
	the `edit` subcommand.
+
In `--stdin` mode, also remove the object names given on standard
input. In other words, `--stdin` can be combined with object names from
the command line.

`prune`::
	Remove all notes for non-existing/unreachable objects.

`get-ref`::
	Print the current notes ref. This provides an easy way to
	retrieve the current notes ref (e.g. from scripts).

OPTIONS
-------
`-f`::
`--force`::
	When adding notes to an object that already has notes,
	overwrite the existing notes (instead of aborting).

`-m <msg>`::
`--message=<msg>`::
	Use the given note message (instead of prompting).
	If multiple `-m` options are given, their values
	are concatenated as separate paragraphs.

`-F <file>`::
`--file=<file>`::
	Take the note message from the given file.  Use `-` to
	read the note message from the standard input.

`-C <object>`::
`--reuse-message=<object>`::
	Take the given blob object (for example, another note) as the
	note message. (Use `git notes copy <object>` instead to
	copy notes between objects.)  Implies `--no-stripspace` since
	the default behavior is to copy the message verbatim.

`-c <object>`::
`--reedit-message=<object>`::
	Like `-C`, but with `-c` the editor is invoked, so that
	the user can further edit the note message.

`--allow-empty`::
	Allow an empty note object to be stored. The default behavior is
	to automatically remove empty notes.

`--separator=<paragraph-break>`::
`--separator`::
`--no-separator`::
	Specify a string used as a custom inter-paragraph separator
	(a newline is added at the end as needed). If `--no-separator`, no
	separators will be added between paragraphs.  Defaults to a blank
	line.

`--stripspace`::
`--no-stripspace`::
	Clean up whitespace. Specifically (see
	linkgit:git-stripspace[1]):
+
--
- remove trailing whitespace from all lines
- collapse

Title: Git Notes Subcommands and Options
Summary
The git-notes command provides various subcommands for managing notes in a Git repository, including copy, append, edit, show, merge, remove, prune, and get-ref. Each subcommand has its own set of options and behaviors, such as overwriting existing notes, specifying note messages, and customizing separators. The command also supports stdin mode for batch operations and provides options for cleaning up whitespace and resolving conflicts during note merges.