$npx -y skills add NeoLabHQ/context-engineering-kit --skill git-notesUse when adding metadata to commits without changing history, tracking review status, test results, code quality annotations, or supplementing commit messages post-hoc - provides git notes commands and patterns for attaching non-invasive metadata to Git objects.
| 1 | # Git Notes |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Git notes attach metadata to commits (or any Git object) without modifying the objects themselves. Notes are stored separately and displayed alongside commit messages. |
| 6 | |
| 7 | **Core principle:** Add information to commits after creation without rewriting history. |
| 8 | |
| 9 | ## Core Concepts |
| 10 | |
| 11 | | Concept | Description | |
| 12 | |---------|-------------| |
| 13 | | **Notes ref** | Storage location, default `refs/notes/commits` | |
| 14 | | **Non-invasive** | Notes never modify SHA of original object | |
| 15 | | **Namespaces** | Use `--ref` for different note categories | |
| 16 | | **Display** | Notes appear in `git log` and `git show` output | |
| 17 | |
| 18 | ## Quick Reference |
| 19 | |
| 20 | | Task | Command | |
| 21 | |------|---------| |
| 22 | | Add note | `git notes add -m "message" <sha>` | |
| 23 | | View note | `git notes show <sha>` | |
| 24 | | Append | `git notes append -m "message" <sha>` | |
| 25 | | Edit | `git notes edit <sha>` | |
| 26 | | Remove | `git notes remove <sha>` | |
| 27 | | Use namespace | `git notes --ref=<name> <command>` | |
| 28 | | Push notes | `git push origin refs/notes/<name>` | |
| 29 | | Fetch notes | `git fetch origin refs/notes/<name>:refs/notes/<name>` | |
| 30 | | Show in log | `git log --notes=<name>` | |
| 31 | |
| 32 | For complete command reference, see `references/commands.md`. |
| 33 | |
| 34 | ## Essential Patterns |
| 35 | |
| 36 | ### Code Review Tracking |
| 37 | |
| 38 | ```bash |
| 39 | # Mark reviewed |
| 40 | git notes --ref=reviews add -m "Reviewed-by: Alice <alice@example.com>" abc1234 |
| 41 | |
| 42 | # View review status |
| 43 | git log --notes=reviews --oneline |
| 44 | ``` |
| 45 | |
| 46 | ### Sharing Notes |
| 47 | |
| 48 | ```bash |
| 49 | # Push to remote |
| 50 | git push origin refs/notes/reviews |
| 51 | |
| 52 | # Fetch from remote |
| 53 | git fetch origin refs/notes/reviews:refs/notes/reviews |
| 54 | ``` |
| 55 | |
| 56 | ### Preserving Through Rebase |
| 57 | |
| 58 | ```bash |
| 59 | git config notes.rewrite.rebase true |
| 60 | git config notes.rewriteMode concatenate |
| 61 | ``` |
| 62 | |
| 63 | ## Common Mistakes |
| 64 | |
| 65 | | Mistake | Fix | |
| 66 | |---------|-----| |
| 67 | | Notes not showing in log | Specify ref: `git log --notes=reviews` or configure `notes.displayRef` | |
| 68 | | Notes lost after rebase | Enable: `git config notes.rewrite.rebase true` | |
| 69 | | Notes not on remote | Push explicitly: `git push origin refs/notes/commits` | |
| 70 | | "Note already exists" error | Use `-f` to overwrite or `append` to add | |
| 71 | |
| 72 | ## Best Practices |
| 73 | |
| 74 | | Practice | Rationale | |
| 75 | |----------|-----------| |
| 76 | | Use namespaces | Separate notes by purpose (reviews, testing, audit) | |
| 77 | | Be explicit about refs | Always specify `--ref` for non-default notes | |
| 78 | | Push notes explicitly | Document sharing procedures in team guidelines | |
| 79 | | Use append over add -f | Preserve note history when accumulating | |
| 80 | | Configure rewrite preservation | Run `git config notes.rewrite.rebase true` before rebasing | |
| 81 | |
| 82 | # Git Notes Command Reference |
| 83 | |
| 84 | Complete reference for all git notes commands and options. |
| 85 | |
| 86 | ## Basic Operations |
| 87 | |
| 88 | ### Add a Note |
| 89 | |
| 90 | ```bash |
| 91 | # Add note to current HEAD |
| 92 | git notes add -m "Reviewed by Alice" |
| 93 | |
| 94 | # Add note to specific commit |
| 95 | git notes add -m "Tested on Linux" abc1234 |
| 96 | |
| 97 | # Add note from file |
| 98 | git notes add -F review-comments.txt abc1234 |
| 99 | |
| 100 | # Add note interactively (opens editor) |
| 101 | git notes add abc1234 |
| 102 | |
| 103 | # Overwrite existing note |
| 104 | git notes add -f -m "Updated review status" abc1234 |
| 105 | |
| 106 | # Add empty note |
| 107 | git notes add --allow-empty abc1234 |
| 108 | ``` |
| 109 | |
| 110 | ### View Notes |
| 111 | |
| 112 | ```bash |
| 113 | # Show note for HEAD |
| 114 | git notes show |
| 115 | |
| 116 | # Show note for specific commit |
| 117 | git notes show abc1234 |
| 118 | |
| 119 | # View commit with notes in log |
| 120 | git log --show-notes |
| 121 | git show abc1234 |
| 122 | |
| 123 | # List all notes |
| 124 | git notes list |
| 125 | |
| 126 | # List note for specific object |
| 127 | git notes list abc1234 |
| 128 | ``` |
| 129 | |
| 130 | **Example output with notes:** |
| 131 | |
| 132 | ``` |
| 133 | commit abc1234def567890 |
| 134 | Author: Developer <dev@example.com> |
| 135 | Date: Mon Jan 15 10:00:00 2024 +0000 |
| 136 | |
| 137 | feat: implement user authentication |
| 138 | |
| 139 | Notes: |
| 140 | Reviewed by Alice |
| 141 | Tested-by: CI Bot <ci@example.com> |
| 142 | ``` |
| 143 | |
| 144 | ### Append to Notes |
| 145 | |
| 146 | ```bash |
| 147 | # Append to existing note (creates if doesn't exist) |
| 148 | git notes append -m "Additional review comment" abc1234 |
| 149 | |
| 150 | # Append from file |
| 151 | git notes append -F more-comments.txt abc1234 |
| 152 | |
| 153 | # Append multiple messages |
| 154 | git notes append -m "Comment 1" -m "Comment 2" abc1234 |
| 155 | ``` |
| 156 | |
| 157 | ### Edit Notes |
| 158 | |
| 159 | ```bash |
| 160 | # Edit note interactively (opens editor) |
| 161 | git notes edit abc1234 |
| 162 | |
| 163 | # Edit note for HEAD |
| 164 | git notes edit |
| 165 | ``` |
| 166 | |
| 167 | ### Remove Notes |
| 168 | |
| 169 | ```bash |
| 170 | # Remove note from HEAD |
| 171 | git notes remove |
| 172 | |
| 173 | # Remove note from specific commit |
| 174 | git notes remove abc1234 |
| 175 | |
| 176 | # Remove notes from multiple commits |
| 177 | git notes remove abc1234 def5678 ghi9012 |
| 178 | |
| 179 | # Ignore missing notes (no error if note doesn't exist) |
| 180 | git notes remove --ignore-missing abc1234 |
| 181 | |
| 182 | # Remove notes via stdin (bulk removal) |
| 183 | echo "abc1234" | git notes remove --stdin |
| 184 | ``` |
| 185 | |
| 186 | ### Copy Notes |
| 187 | |
| 188 | ```bash |
| 189 | # Copy note from one commit to another |
| 190 | git notes copy abc1234 def5678 |
| 191 | |
| 192 | # Copy note to HEAD |
| 193 | git notes copy abc1234 |
| 194 | |
| 195 | # Force overwrite destination note |
| 196 | git notes copy -f abc1234 def5678 |
| 197 | |
| 198 | # Bulk copy via stdin (useful with rebase/cherry-pick) |
| 199 | echo "abc1234 def5678" | gi |