Git Notes#

Git Notes add text notes to commits, tags and other objects. Such notes can contain all kinds of metadata, for example comments on code review, links to bug reports, etc:

  1. Add a git note:

    $ git notes add -m 'Example note'
    
  2. Display a git note:

    $ git log
    commit 859de540cda23f510f4ecbe0f38d07666e933f08 (HEAD -> main)
    Author: Veit Schiele <veit@cusy.io>
    Date:   Sun Mar 24 11:17:56 2024 +0100
    
        A commit message
    
    Notes:
        Example note
    
  3. Change a git note:

    $ git notes edit
    

However, Git notes are not sent to the remote repository with git push or git pull by default; they must be synchronised with git push origin 'refs/notes/*' and git fetch origin 'refs/notes/*:refs/notes/*'.

Warning

Do not use git pull instead of git fetch: you will not be able to merge refs/notes/commits with your current branch.

Note

Git notes are not included in the git commit history, so they cannot be used for regulatory purposes where provenance, non-repudiation or tamper resistance must be proven. However, they can be useful for build tags and similar.