[{"data":1,"prerenderedAt":437},["ShallowReactive",2],{"tidbit-git-notes":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"body":11,"_type":431,"_id":432,"_source":433,"_file":434,"_stem":435,"_extension":436},"/tidbits/git-notes","tidbits",false,"","Git Notes","Git can attach metadata to a commit without rewriting it. git notes lets you bolt extra context onto history after the fact — review links, deploy info, context that didn't fit the message — without touching the SHA.","2026-05-29",{"type":12,"children":13,"toc":429},"root",[14,39,48,53,61,156,161,208,216,251,259,272,337,342,355,411,423],{"type":15,"tag":16,"props":17,"children":18},"element","p",{},[19,22,29,31,37],{"type":20,"value":21},"text","Here's a Git feature almost nobody uses: ",{"type":15,"tag":23,"props":24,"children":26},"code",{"className":25},[],[27],{"type":20,"value":28},"git notes",{"type":20,"value":30},". It lets you attach extra metadata to a commit ",{"type":15,"tag":32,"props":33,"children":34},"em",{},[35],{"type":20,"value":36},"after",{"type":20,"value":38}," it's been made — without rewriting history or changing the SHA.",{"type":15,"tag":16,"props":40,"children":41},{},[42],{"type":15,"tag":43,"props":44,"children":45},"strong",{},[46],{"type":20,"value":47},"The problem it solves",{"type":15,"tag":16,"props":49,"children":50},{},[51],{"type":20,"value":52},"You write a commit message, push it, and only later realise you wanted to record something — a review link, a deploy timestamp, why a weird workaround exists. Amending means a new SHA and a force push. Notes sidestep that entirely. The commit stays exactly as it was; the note rides alongside it.",{"type":15,"tag":16,"props":54,"children":55},{},[56],{"type":15,"tag":43,"props":57,"children":58},{},[59],{"type":20,"value":60},"The basics",{"type":15,"tag":62,"props":63,"children":67},"pre",{"className":64,"code":65,"language":66,"meta":7,"style":7},"language-bash shiki shiki-themes github-light","git notes add -m \"Reviewed by Sam, deployed 2026-05-29\" HEAD\ngit notes show HEAD          # read it back\ngit log                      # notes show under the commit automatically\n","bash",[68],{"type":15,"tag":23,"props":69,"children":70},{"__ignoreMap":7},[71,110,138],{"type":15,"tag":72,"props":73,"children":76},"span",{"class":74,"line":75},"line",1,[77,83,89,94,100,105],{"type":15,"tag":72,"props":78,"children":80},{"style":79},"--shiki-default:#6F42C1",[81],{"type":20,"value":82},"git",{"type":15,"tag":72,"props":84,"children":86},{"style":85},"--shiki-default:#032F62",[87],{"type":20,"value":88}," notes",{"type":15,"tag":72,"props":90,"children":91},{"style":85},[92],{"type":20,"value":93}," add",{"type":15,"tag":72,"props":95,"children":97},{"style":96},"--shiki-default:#005CC5",[98],{"type":20,"value":99}," -m",{"type":15,"tag":72,"props":101,"children":102},{"style":85},[103],{"type":20,"value":104}," \"Reviewed by Sam, deployed 2026-05-29\"",{"type":15,"tag":72,"props":106,"children":107},{"style":85},[108],{"type":20,"value":109}," HEAD\n",{"type":15,"tag":72,"props":111,"children":113},{"class":74,"line":112},2,[114,118,122,127,132],{"type":15,"tag":72,"props":115,"children":116},{"style":79},[117],{"type":20,"value":82},{"type":15,"tag":72,"props":119,"children":120},{"style":85},[121],{"type":20,"value":88},{"type":15,"tag":72,"props":123,"children":124},{"style":85},[125],{"type":20,"value":126}," show",{"type":15,"tag":72,"props":128,"children":129},{"style":85},[130],{"type":20,"value":131}," HEAD",{"type":15,"tag":72,"props":133,"children":135},{"style":134},"--shiki-default:#6A737D",[136],{"type":20,"value":137},"          # read it back\n",{"type":15,"tag":72,"props":139,"children":141},{"class":74,"line":140},3,[142,146,151],{"type":15,"tag":72,"props":143,"children":144},{"style":79},[145],{"type":20,"value":82},{"type":15,"tag":72,"props":147,"children":148},{"style":85},[149],{"type":20,"value":150}," log",{"type":15,"tag":72,"props":152,"children":153},{"style":134},[154],{"type":20,"value":155},"                      # notes show under the commit automatically\n",{"type":15,"tag":16,"props":157,"children":158},{},[159],{"type":20,"value":160},"Edit or remove them just as easily:",{"type":15,"tag":62,"props":162,"children":164},{"className":64,"code":163,"language":66,"meta":7,"style":7},"git notes edit HEAD\ngit notes remove HEAD\n",[165],{"type":15,"tag":23,"props":166,"children":167},{"__ignoreMap":7},[168,188],{"type":15,"tag":72,"props":169,"children":170},{"class":74,"line":75},[171,175,179,184],{"type":15,"tag":72,"props":172,"children":173},{"style":79},[174],{"type":20,"value":82},{"type":15,"tag":72,"props":176,"children":177},{"style":85},[178],{"type":20,"value":88},{"type":15,"tag":72,"props":180,"children":181},{"style":85},[182],{"type":20,"value":183}," edit",{"type":15,"tag":72,"props":185,"children":186},{"style":85},[187],{"type":20,"value":109},{"type":15,"tag":72,"props":189,"children":190},{"class":74,"line":112},[191,195,199,204],{"type":15,"tag":72,"props":192,"children":193},{"style":79},[194],{"type":20,"value":82},{"type":15,"tag":72,"props":196,"children":197},{"style":85},[198],{"type":20,"value":88},{"type":15,"tag":72,"props":200,"children":201},{"style":85},[202],{"type":20,"value":203}," remove",{"type":15,"tag":72,"props":205,"children":206},{"style":85},[207],{"type":20,"value":109},{"type":15,"tag":16,"props":209,"children":210},{},[211],{"type":15,"tag":43,"props":212,"children":213},{},[214],{"type":20,"value":215},"Where it earns its keep",{"type":15,"tag":217,"props":218,"children":219},"ul",{},[220,231,241],{"type":15,"tag":221,"props":222,"children":223},"li",{},[224,229],{"type":15,"tag":43,"props":225,"children":226},{},[227],{"type":20,"value":228},"CI/CD metadata",{"type":20,"value":230}," — stamp a commit with the build number or deploy URL it shipped in.",{"type":15,"tag":221,"props":232,"children":233},{},[234,239],{"type":15,"tag":43,"props":235,"children":236},{},[237],{"type":20,"value":238},"Review context",{"type":20,"value":240}," — link the PR, record who signed off, without polluting the message.",{"type":15,"tag":221,"props":242,"children":243},{},[244,249],{"type":15,"tag":43,"props":245,"children":246},{},[247],{"type":20,"value":248},"After-the-fact explanation",{"type":20,"value":250}," — the \"why\" you only understood three weeks later.",{"type":15,"tag":16,"props":252,"children":253},{},[254],{"type":15,"tag":43,"props":255,"children":256},{},[257],{"type":20,"value":258},"The catch you need to know",{"type":15,"tag":16,"props":260,"children":261},{},[262,264,270],{"type":20,"value":263},"Notes don't push or pull by default. They live in their own ref, ",{"type":15,"tag":23,"props":265,"children":267},{"className":266},[],[268],{"type":20,"value":269},"refs/notes/commits",{"type":20,"value":271},", and Git leaves them on your machine unless you tell it otherwise:",{"type":15,"tag":62,"props":273,"children":275},{"className":64,"code":274,"language":66,"meta":7,"style":7},"git push origin refs/notes/commits\ngit fetch origin refs/notes/*:refs/notes/*\n",[276],{"type":15,"tag":23,"props":277,"children":278},{"__ignoreMap":7},[279,301],{"type":15,"tag":72,"props":280,"children":281},{"class":74,"line":75},[282,286,291,296],{"type":15,"tag":72,"props":283,"children":284},{"style":79},[285],{"type":20,"value":82},{"type":15,"tag":72,"props":287,"children":288},{"style":85},[289],{"type":20,"value":290}," push",{"type":15,"tag":72,"props":292,"children":293},{"style":85},[294],{"type":20,"value":295}," origin",{"type":15,"tag":72,"props":297,"children":298},{"style":85},[299],{"type":20,"value":300}," refs/notes/commits\n",{"type":15,"tag":72,"props":302,"children":303},{"class":74,"line":112},[304,308,313,317,322,327,332],{"type":15,"tag":72,"props":305,"children":306},{"style":79},[307],{"type":20,"value":82},{"type":15,"tag":72,"props":309,"children":310},{"style":85},[311],{"type":20,"value":312}," fetch",{"type":15,"tag":72,"props":314,"children":315},{"style":85},[316],{"type":20,"value":295},{"type":15,"tag":72,"props":318,"children":319},{"style":85},[320],{"type":20,"value":321}," refs/notes/",{"type":15,"tag":72,"props":323,"children":324},{"style":96},[325],{"type":20,"value":326},"*",{"type":15,"tag":72,"props":328,"children":329},{"style":85},[330],{"type":20,"value":331},":refs/notes/",{"type":15,"tag":72,"props":333,"children":334},{"style":96},[335],{"type":20,"value":336},"*\n",{"type":15,"tag":16,"props":338,"children":339},{},[340],{"type":20,"value":341},"That's the one gotcha that bites people — they add notes, never see them on the remote, and assume the feature is broken.",{"type":15,"tag":16,"props":343,"children":344},{},[345,347,353],{"type":20,"value":346},"You can also keep separate categories with ",{"type":15,"tag":23,"props":348,"children":350},{"className":349},[],[351],{"type":20,"value":352},"--ref",{"type":20,"value":354},":",{"type":15,"tag":62,"props":356,"children":358},{"className":64,"code":357,"language":66,"meta":7,"style":7},"git notes --ref=deploys add -m \"shipped in v2.3.1\" HEAD\ngit log --notes=deploys\n",[359],{"type":15,"tag":23,"props":360,"children":361},{"__ignoreMap":7},[362,395],{"type":15,"tag":72,"props":363,"children":364},{"class":74,"line":75},[365,369,373,378,382,386,391],{"type":15,"tag":72,"props":366,"children":367},{"style":79},[368],{"type":20,"value":82},{"type":15,"tag":72,"props":370,"children":371},{"style":85},[372],{"type":20,"value":88},{"type":15,"tag":72,"props":374,"children":375},{"style":96},[376],{"type":20,"value":377}," --ref=deploys",{"type":15,"tag":72,"props":379,"children":380},{"style":85},[381],{"type":20,"value":93},{"type":15,"tag":72,"props":383,"children":384},{"style":96},[385],{"type":20,"value":99},{"type":15,"tag":72,"props":387,"children":388},{"style":85},[389],{"type":20,"value":390}," \"shipped in v2.3.1\"",{"type":15,"tag":72,"props":392,"children":393},{"style":85},[394],{"type":20,"value":109},{"type":15,"tag":72,"props":396,"children":397},{"class":74,"line":112},[398,402,406],{"type":15,"tag":72,"props":399,"children":400},{"style":79},[401],{"type":20,"value":82},{"type":15,"tag":72,"props":403,"children":404},{"style":85},[405],{"type":20,"value":150},{"type":15,"tag":72,"props":407,"children":408},{"style":96},[409],{"type":20,"value":410}," --notes=deploys\n",{"type":15,"tag":16,"props":412,"children":413},{},[414,416,421],{"type":20,"value":415},"It's not something I reach for daily. But when you want to annotate history ",{"type":15,"tag":32,"props":417,"children":418},{},[419],{"type":20,"value":420},"without",{"type":20,"value":422}," rewriting it, nothing else does the job as cleanly.",{"type":15,"tag":424,"props":425,"children":426},"style",{},[427],{"type":20,"value":428},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":7,"searchDepth":112,"depth":112,"links":430},[],"markdown","content:tidbits:git-notes.md","content","tidbits/git-notes.md","tidbits/git-notes","md",1780036250735]