Skip to content

Commit f7453f2

Browse files
committed
📝 Extend the git notes section
1 parent 20fcb9f commit f7453f2

File tree

2 files changed

+58
-14
lines changed

2 files changed

+58
-14
lines changed

docs/productive/git/advanced/index.rst

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Advanced Git
1010

1111
cherry-pick
1212
bisect
13+
notes
1314
hooks/index
1415
jupyter-notebooks
1516
binary-files
@@ -18,20 +19,6 @@ Advanced Git
1819
git-big-picture
1920
etckeeper
2021

21-
Git Notes
22-
---------
23-
24-
`Git Notes <https://git-scm.com/docs/git-notes>`_ adds text notes to commits,
25-
tags and other objects. Such notes can contain all kinds of metadata, for
26-
example code review comments, links to bug reports, :abbr:`etc (et cetera)`.
27-
28-
.. seealso::
29-
* `Git Notes: Git’s Coolest, Most Unloved­ Feature
30-
<https://tylercipriani.com/blog/2022/11/19/git-notes-gits-coolest-most-unloved-feature/>`_
31-
* `git-appraise <https://github.com/google/git-appraise>`_
32-
* `github-issues-git-notes
33-
<https://github.com/TomasHubelbauer/github-issues-git-notes>`_
34-
3522
Git’s database internals
3623
------------------------
3724

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
.. SPDX-FileCopyrightText: 2020 Veit Schiele
2+
..
3+
.. SPDX-License-Identifier: BSD-3-Clause
4+
5+
Git Notes
6+
=========
7+
8+
`Git Notes <https://git-scm.com/docs/git-notes>`_ add text notes to commits,
9+
tags and other objects. Such notes can contain all kinds of metadata, for
10+
example comments on code review, links to bug reports, :abbr:`etc (et cetera)`:
11+
12+
#. Add a git note:
13+
14+
.. code-block:: console
15+
16+
$ git notes add -m 'Example note'
17+
18+
#. Display a git note:
19+
20+
.. code-block:: console
21+
22+
$ git log
23+
commit 859de540cda23f510f4ecbe0f38d07666e933f08 (HEAD -> main)
24+
Author: Veit Schiele <[email protected]>
25+
Date: Sun Mar 24 11:17:56 2024 +0100
26+
27+
A commit message
28+
29+
Notes:
30+
Example note
31+
32+
#. Change a git note:
33+
34+
.. code-block:: console
35+
36+
$ git notes edit
37+
38+
However, Git notes are not sent to the remote repository with ``git push`` or
39+
``git pull`` by default; they must be synchronised with ``git push origin
40+
'refs/notes/*'`` and ``git fetch origin 'refs/notes/*:refs/notes/*'``.
41+
42+
.. warning::
43+
Do not use ``git pull`` instead of ``git fetch``: you will not be able to
44+
merge ``refs/notes/commits`` with your current branch.
45+
46+
.. note::
47+
Git notes are not included in the git commit history, so they cannot be used
48+
for regulatory purposes where provenance, non-repudiation or tamper
49+
resistance must be proven. However, they can be useful for build tags and
50+
similar.
51+
52+
.. seealso::
53+
* `Git Notes: Git’s Coolest, Most Unloved­ Feature
54+
<https://tylercipriani.com/blog/2022/11/19/git-notes-gits-coolest-most-unloved-feature/>`_
55+
* `git-appraise <https://github.com/google/git-appraise>`_
56+
* `github-issues-git-notes
57+
<https://github.com/TomasHubelbauer/github-issues-git-notes>`_

0 commit comments

Comments
 (0)