{
    "mode": "man",
    "parameter": "git-notes",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/git-notes/1/json",
    "generated": "2026-06-02T22:31:32Z",
    "synopsis": "git notes [list [<object>]]\ngit notes add [-f] [--allow-empty] [-F <file> | -m <msg> | (-c | -C) <object>] [<object>]\ngit notes copy [-f] ( --stdin | <from-object> [<to-object>] )\ngit notes append [--allow-empty] [-F <file> | -m <msg> | (-c | -C) <object>] [<object>]\ngit notes edit [--allow-empty] [<object>]\ngit notes show [<object>]\ngit notes merge [-v | -q] [-s <strategy> ] <notes-ref>\ngit notes merge --commit [-v | -q]\ngit notes merge --abort [-v | -q]\ngit notes remove [--ignore-missing] [--stdin] [<object>...]\ngit notes prune [-n] [-v]\ngit notes get-ref",
    "sections": {
        "NAME": {
            "content": "git-notes - Add or inspect object notes\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "git notes [list [<object>]]\ngit notes add [-f] [--allow-empty] [-F <file> | -m <msg> | (-c | -C) <object>] [<object>]\ngit notes copy [-f] ( --stdin | <from-object> [<to-object>] )\ngit notes append [--allow-empty] [-F <file> | -m <msg> | (-c | -C) <object>] [<object>]\ngit notes edit [--allow-empty] [<object>]\ngit notes show [<object>]\ngit notes merge [-v | -q] [-s <strategy> ] <notes-ref>\ngit notes merge --commit [-v | -q]\ngit notes merge --abort [-v | -q]\ngit notes remove [--ignore-missing] [--stdin] [<object>...]\ngit notes prune [-n] [-v]\ngit notes get-ref\n\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Adds, removes, or reads notes attached to objects, without touching the objects themselves.\n\nBy default, notes are saved to and read from refs/notes/commits, but this default can be\noverridden. See the OPTIONS, CONFIGURATION, and ENVIRONMENT sections below. If this ref does\nnot exist, it will be quietly created when it is first needed to store a note.\n\nA typical use of notes is to supplement a commit message without changing the commit itself.\nNotes can be shown by git log along with the original commit message. To distinguish these\nnotes from the message stored in the commit object, the notes are indented like the message,\nafter an unindented line saying \"Notes (<refname>):\" (or \"Notes:\" for refs/notes/commits).\n\nNotes can also be added to patches prepared with git format-patch by using the --notes\noption. Such notes are added as a patch commentary after a three dash separator line.\n\nTo change which notes are shown by git log, see the \"notes.displayRef\" configuration in git-\nlog(1).\n\nSee the \"notes.rewrite.<command>\" configuration for a way to carry notes across commands that\nrewrite commits.\n",
            "subsections": []
        },
        "SUBCOMMANDS": {
            "content": "list\nList the notes object for a given object. If no object is given, show a list of all note\nobjects and the objects they annotate (in the format \"<note object> <annotated object>\").\nThis is the default subcommand if no subcommand is given.\n\nadd\nAdd notes for a given object (defaults to HEAD). Abort if the object already has notes\n(use -f to overwrite existing notes). However, if you’re using add interactively (using\nan editor to supply the notes contents), then - instead of aborting - the existing notes\nwill be opened in the editor (like the edit subcommand).\n\ncopy\nCopy the notes for the first object onto the second object (defaults to HEAD). Abort if\nthe second object already has notes, or if the first object has none (use -f to overwrite\nexisting notes to the second object). This subcommand is equivalent to: git notes add\n[-f] -C $(git notes list <from-object>) <to-object>\n\nIn --stdin mode, take lines in the format\n\n<from-object> SP <to-object> [ SP <rest> ] LF\n\non standard input, and copy the notes from each <from-object> to its corresponding\n<to-object>. (The optional <rest> is ignored so that the command can read the input given\nto the post-rewrite hook.)\n\nappend\nAppend to the notes of an existing object (defaults to HEAD). Creates a new notes object\nif needed.\n\nedit\nEdit the notes for a given object (defaults to HEAD).\n\nshow\nShow the notes for a given object (defaults to HEAD).\n\nmerge\nMerge the given notes ref into the current notes ref. This will try to merge the changes\nmade by the given notes ref (called \"remote\") since the merge-base (if any) into the\ncurrent notes ref (called \"local\").\n\nIf conflicts arise and a strategy for automatically resolving conflicting notes (see the\n\"NOTES MERGE STRATEGIES\" section) is not given, the \"manual\" resolver is used. This\nresolver checks out the conflicting notes in a special worktree\n(.git/NOTESMERGEWORKTREE), and instructs the user to manually resolve the conflicts\nthere. When done, the user can either finalize the merge with git notes merge --commit,\nor abort the merge with git notes merge --abort.\n\nremove\nRemove the notes for given objects (defaults to HEAD). When giving zero or one object\nfrom the command line, this is equivalent to specifying an empty note message to the edit\nsubcommand.\n\nprune\nRemove all notes for non-existing/unreachable objects.\n\nget-ref\nPrint the current notes ref. This provides an easy way to retrieve the current notes ref\n(e.g. from scripts).\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-f, --force",
                    "content": "When adding notes to an object that already has notes, overwrite the existing notes\n(instead of aborting).\n\n-m <msg>, --message=<msg>\nUse the given note message (instead of prompting). If multiple -m options are given,\ntheir values are concatenated as separate paragraphs. Lines starting with # and empty\nlines other than a single line between paragraphs will be stripped out.\n\n-F <file>, --file=<file>\nTake the note message from the given file. Use - to read the note message from the\nstandard input. Lines starting with # and empty lines other than a single line between\nparagraphs will be stripped out.\n\n-C <object>, --reuse-message=<object>\nTake the given blob object (for example, another note) as the note message. (Use git\nnotes copy <object> instead to copy notes between objects.)\n\n-c <object>, --reedit-message=<object>\nLike -C, but with -c the editor is invoked, so that the user can further edit the note\nmessage.\n",
                    "flag": "-f",
                    "long": "--force"
                },
                {
                    "name": "--allow-empty",
                    "content": "Allow an empty note object to be stored. The default behavior is to automatically remove\nempty notes.\n",
                    "long": "--allow-empty"
                },
                {
                    "name": "--ref <ref>",
                    "content": "Manipulate the notes tree in <ref>. This overrides GITNOTESREF and the \"core.notesRef\"\nconfiguration. The ref specifies the full refname when it begins with refs/notes/; when\nit begins with notes/, refs/ and otherwise refs/notes/ is prefixed to form a full name of\nthe ref.\n",
                    "long": "--ref",
                    "arg": "<ref>"
                },
                {
                    "name": "--ignore-missing",
                    "content": "Do not consider it an error to request removing notes from an object that does not have\nnotes attached to it.\n",
                    "long": "--ignore-missing"
                },
                {
                    "name": "--stdin",
                    "content": "Also read the object names to remove notes from the standard input (there is no reason\nyou cannot combine this with object names from the command line).\n",
                    "long": "--stdin"
                },
                {
                    "name": "-n, --dry-run",
                    "content": "Do not remove anything; just report the object names whose notes would be removed.\n\n-s <strategy>, --strategy=<strategy>\nWhen merging notes, resolve notes conflicts using the given strategy. The following\nstrategies are recognized: \"manual\" (default), \"ours\", \"theirs\", \"union\" and\n\"catsortuniq\". This option overrides the \"notes.mergeStrategy\" configuration setting.\nSee the \"NOTES MERGE STRATEGIES\" section below for more information on each notes merge\nstrategy.\n",
                    "flag": "-n",
                    "long": "--dry-run"
                },
                {
                    "name": "--commit",
                    "content": "Finalize an in-progress git notes merge. Use this option when you have resolved the\nconflicts that git notes merge stored in .git/NOTESMERGEWORKTREE. This amends the\npartial merge commit created by git notes merge (stored in .git/NOTESMERGEPARTIAL) by\nadding the notes in .git/NOTESMERGEWORKTREE. The notes ref stored in the\n.git/NOTESMERGEREF symref is updated to the resulting commit.\n",
                    "long": "--commit"
                },
                {
                    "name": "--abort",
                    "content": "Abort/reset an in-progress git notes merge, i.e. a notes merge with conflicts. This\nsimply removes all files related to the notes merge.\n",
                    "long": "--abort"
                },
                {
                    "name": "-q, --quiet",
                    "content": "When merging notes, operate quietly.\n",
                    "flag": "-q",
                    "long": "--quiet"
                },
                {
                    "name": "-v, --verbose",
                    "content": "When merging notes, be more verbose. When pruning notes, report all object names whose\nnotes are removed.\n",
                    "flag": "-v",
                    "long": "--verbose"
                }
            ]
        },
        "DISCUSSION": {
            "content": "Commit notes are blobs containing extra information about an object (usually information to\nsupplement a commit’s message). These blobs are taken from notes refs. A notes ref is usually\na branch which contains \"files\" whose paths are the object names for the objects they\ndescribe, with some directory separators included for performance reasons [1].\n\nEvery notes change creates a new commit at the specified notes ref. You can therefore inspect\nthe history of the notes by invoking, e.g., git log -p notes/commits. Currently the commit\nmessage only records which operation triggered the update, and the commit authorship is\ndetermined according to the usual rules (see git-commit(1)). These details may change in the\nfuture.\n\nIt is also permitted for a notes ref to point directly to a tree object, in which case the\nhistory of the notes can be read with git log -p -g <refname>.\n",
            "subsections": []
        },
        "NOTES MERGE STRATEGIES": {
            "content": "The default notes merge strategy is \"manual\", which checks out conflicting notes in a special\nwork tree for resolving notes conflicts (.git/NOTESMERGEWORKTREE), and instructs the user\nto resolve the conflicts in that work tree. When done, the user can either finalize the merge\nwith git notes merge --commit, or abort the merge with git notes merge --abort.\n\nUsers may select an automated merge strategy from among the following using either\n-s/--strategy option or configuring notes.mergeStrategy accordingly:\n\n\"ours\" automatically resolves conflicting notes in favor of the local version (i.e. the\ncurrent notes ref).\n\n\"theirs\" automatically resolves notes conflicts in favor of the remote version (i.e. the\ngiven notes ref being merged into the current notes ref).\n\n\"union\" automatically resolves notes conflicts by concatenating the local and remote\nversions.\n\n\"catsortuniq\" is similar to \"union\", but in addition to concatenating the local and remote\nversions, this strategy also sorts the resulting lines, and removes duplicate lines from the\nresult. This is equivalent to applying the \"cat | sort | uniq\" shell pipeline to the local\nand remote versions. This strategy is useful if the notes follow a line-based format where\none wants to avoid duplicated lines in the merge result. Note that if either the local or\nremote version contain duplicate lines prior to the merge, these will also be removed by this\nnotes merge strategy.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "You can use notes to add annotations with information that was not available at the time a\ncommit was written.\n\n$ git notes add -m 'Tested-by: Johannes Sixt <j6t@kdbg.org>' 72a144e2\n$ git show -s 72a144e\n[...]\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n\nNotes:\nTested-by: Johannes Sixt <j6t@kdbg.org>\n\n\nIn principle, a note is a regular Git blob, and any kind of (non-)format is accepted. You can\nbinary-safely create notes from arbitrary files using git hash-object:\n\n$ cc *.c\n$ blob=$(git hash-object -w a.out)\n$ git notes --ref=built add --allow-empty -C \"$blob\" HEAD\n\n\n(You cannot simply use git notes --ref=built add -F a.out HEAD because that is not\nbinary-safe.) Of course, it doesn’t make much sense to display non-text-format notes with git\nlog, so if you use such notes, you’ll probably need to write some special-purpose tools to do\nsomething useful with them.\n",
            "subsections": []
        },
        "CONFIGURATION": {
            "content": "core.notesRef\nNotes ref to read and manipulate instead of refs/notes/commits. Must be an unabbreviated\nref name. This setting can be overridden through the environment and command line.\n\nnotes.mergeStrategy\nWhich merge strategy to choose by default when resolving notes conflicts. Must be one of\nmanual, ours, theirs, union, or catsortuniq. Defaults to manual. See \"NOTES MERGE\nSTRATEGIES\" section above for more information on each strategy.\n\nThis setting can be overridden by passing the --strategy option.\n\nnotes.<name>.mergeStrategy\nWhich merge strategy to choose when doing a notes merge into refs/notes/<name>. This\noverrides the more general \"notes.mergeStrategy\". See the \"NOTES MERGE STRATEGIES\"\nsection above for more information on each available strategy.\n\nnotes.displayRef\nWhich ref (or refs, if a glob or specified more than once), in addition to the default\nset by core.notesRef or GITNOTESREF, to read notes from when showing commit messages\nwith the git log family of commands. This setting can be overridden on the command line\nor by the GITNOTESDISPLAYREF environment variable. See git-log(1).\n\nnotes.rewrite.<command>\nWhen rewriting commits with <command> (currently amend or rebase), if this variable is\nfalse, git will not copy notes from the original to the rewritten commit. Defaults to\ntrue. See also \"notes.rewriteRef\" below.\n\nThis setting can be overridden by the GITNOTESREWRITEREF environment variable.\n\nnotes.rewriteMode\nWhen copying notes during a rewrite, what to do if the target commit already has a note.\nMust be one of overwrite, concatenate, catsortuniq, or ignore. Defaults to concatenate.\n\nThis setting can be overridden with the GITNOTESREWRITEMODE environment variable.\n\nnotes.rewriteRef\nWhen copying notes during a rewrite, specifies the (fully qualified) ref whose notes\nshould be copied. May be a glob, in which case notes in all matching refs will be copied.\nYou may also specify this configuration several times.\n\nDoes not have a default value; you must configure this variable to enable note rewriting.\n\nCan be overridden with the GITNOTESREWRITEREF environment variable.\n",
            "subsections": []
        },
        "ENVIRONMENT": {
            "content": "GITNOTESREF\nWhich ref to manipulate notes from, instead of refs/notes/commits. This overrides the\ncore.notesRef setting.\n\nGITNOTESDISPLAYREF\nColon-delimited list of refs or globs indicating which refs, in addition to the default\nfrom core.notesRef or GITNOTESREF, to read notes from when showing commit messages.\nThis overrides the notes.displayRef setting.\n\nA warning will be issued for refs that do not exist, but a glob that does not match any\nrefs is silently ignored.\n\nGITNOTESREWRITEMODE\nWhen copying notes during a rewrite, what to do if the target commit already has a note.\nMust be one of overwrite, concatenate, catsortuniq, or ignore. This overrides the\ncore.rewriteMode setting.\n\nGITNOTESREWRITEREF\nWhen rewriting commits, which notes to copy from the original to the rewritten commit.\nMust be a colon-delimited list of refs or globs.\n\nIf not set in the environment, the list of notes to copy depends on the\nnotes.rewrite.<command> and notes.rewriteRef settings.\n",
            "subsections": []
        },
        "GIT": {
            "content": "Part of the git(1) suite\n",
            "subsections": []
        },
        "NOTES": {
            "content": "1. Permitted pathnames have the form bf/fe/30/.../680d5a...: a sequence of directory names\nof two hexadecimal digits each followed by a filename with the rest of the object ID.\n\n\n\n\nGit 2.34.1                                   02/26/2026                                 GIT-NOTES(1)",
            "subsections": []
        }
    },
    "summary": "git-notes - Add or inspect object notes",
    "flags": [
        {
            "flag": "-f",
            "long": "--force",
            "arg": null,
            "description": "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. Lines starting with # and empty lines other than a single line between paragraphs will be stripped out. -F <file>, --file=<file> Take the note message from the given file. Use - to read the note message from the standard input. Lines starting with # and empty lines other than a single line between paragraphs will be stripped out. -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.) -c <object>, --reedit-message=<object> Like -C, but with -c the editor is invoked, so that the user can further edit the note message."
        },
        {
            "flag": "",
            "long": "--allow-empty",
            "arg": null,
            "description": "Allow an empty note object to be stored. The default behavior is to automatically remove empty notes."
        },
        {
            "flag": "",
            "long": "--ref",
            "arg": "<ref>",
            "description": "Manipulate the notes tree in <ref>. This overrides GITNOTESREF and the \"core.notesRef\" configuration. The ref specifies the full refname when it begins with refs/notes/; when it begins with notes/, refs/ and otherwise refs/notes/ is prefixed to form a full name of the ref."
        },
        {
            "flag": "",
            "long": "--ignore-missing",
            "arg": null,
            "description": "Do not consider it an error to request removing notes from an object that does not have notes attached to it."
        },
        {
            "flag": "",
            "long": "--stdin",
            "arg": null,
            "description": "Also read the object names to remove notes from the standard input (there is no reason you cannot combine this with object names from the command line)."
        },
        {
            "flag": "-n",
            "long": "--dry-run",
            "arg": null,
            "description": "Do not remove anything; just report the object names whose notes would be removed. -s <strategy>, --strategy=<strategy> When merging notes, resolve notes conflicts using the given strategy. The following strategies are recognized: \"manual\" (default), \"ours\", \"theirs\", \"union\" and \"catsortuniq\". This option overrides the \"notes.mergeStrategy\" configuration setting. See the \"NOTES MERGE STRATEGIES\" section below for more information on each notes merge strategy."
        },
        {
            "flag": "",
            "long": "--commit",
            "arg": null,
            "description": "Finalize an in-progress git notes merge. Use this option when you have resolved the conflicts that git notes merge stored in .git/NOTESMERGEWORKTREE. This amends the partial merge commit created by git notes merge (stored in .git/NOTESMERGEPARTIAL) by adding the notes in .git/NOTESMERGEWORKTREE. The notes ref stored in the .git/NOTESMERGEREF symref is updated to the resulting commit."
        },
        {
            "flag": "",
            "long": "--abort",
            "arg": null,
            "description": "Abort/reset an in-progress git notes merge, i.e. a notes merge with conflicts. This simply removes all files related to the notes merge."
        },
        {
            "flag": "-q",
            "long": "--quiet",
            "arg": null,
            "description": "When merging notes, operate quietly."
        },
        {
            "flag": "-v",
            "long": "--verbose",
            "arg": null,
            "description": "When merging notes, be more verbose. When pruning notes, report all object names whose notes are removed."
        }
    ],
    "examples": [
        "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 --allow-empty -C \"$blob\" HEAD",
        "(You cannot simply use git notes --ref=built add -F a.out HEAD because that is not",
        "binary-safe.) 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."
    ],
    "see_also": [],
    "tldr": {
        "source": "official",
        "description": "Add or inspect object notes.",
        "examples": [
            {
                "description": "List all notes and the objects they are attached to",
                "command": "git notes list"
            },
            {
                "description": "List all notes attached to a given object (defaults to `HEAD`)",
                "command": "git notes list [{{object}}]"
            },
            {
                "description": "Show the notes attached to a given object (defaults to `HEAD`)",
                "command": "git notes show [{{object}}]"
            },
            {
                "description": "Append a note to a specified object (opens the default text editor)",
                "command": "git notes append {{object}}"
            },
            {
                "description": "Append a note to a specified object, specifying the message",
                "command": "git notes append --message=\"{{message_text}}\""
            },
            {
                "description": "Edit an existing note (defaults to `HEAD`)",
                "command": "git notes edit [{{object}}]"
            },
            {
                "description": "Copy a note from one object to another",
                "command": "git notes copy {{source_object}} {{target_object}}"
            },
            {
                "description": "Remove all the notes added to a specified object",
                "command": "git notes remove {{object}}"
            }
        ]
    }
}