commits-with-notes
history
two commits annotated with git notes; first commit also carries a note in a second namespace (refs/notes/ci)
Description
Notes are metadata attached to commits *outside* the commit object itself:
they can be added, updated, or removed without rewriting history.
Layout:
HEAD~1 (`feat: initial widget`):
refs/notes/commits → "Reviewed-by: Alice <alice@example.com>"
refs/notes/ci → "CI: passed"
HEAD (`fix: widget alignment`):
refs/notes/commits → "Reviewed-by: Bob <bob@example.com>\nCoverage: 92%"
The HEAD note is built with `git notes add` followed by `git notes append`,
producing a multi-line note without rewriting the first entry.
Useful for testing:
- `git log --show-notes` display and note content parsing
- `git notes list` output across namespaces
- Note-aware diff and annotation tools
- Multi-namespace enumeration (`git notes --ref=refs/notes/ci list`) Contracts
- main is checked out
- main has 2 commits
- HEAD~1 has a note in refs/notes/commits containing "Reviewed-by: Alice"
- HEAD~1 has a note in refs/notes/ci containing "CI: passed"
- HEAD has a note in refs/notes/commits containing "Reviewed-by: Bob" and "Coverage: 92%"
Tags
Branches
main Use it
import { spinUpScenario } from '@gfargo/git-scenarios'
const repo = await spinUpScenario('commits-with-notes') npx git-scenarios create commits-with-notes import { describeWithScenario } from '@gfargo/git-scenarios/jest'
describeWithScenario('commits-with-notes', (getRepo) => {
it('should have the expected state', async () => {
const repo = getRepo()
// your assertions here
})
}) Commit graph
* c8df691 (HEAD -> main) fix: widget alignment
* f42f25b feat: initial widget
* 465151c Notes added by 'git notes append'
* fbc9631 Notes added by 'git notes add'
* 3ce2336 Notes added by 'git notes add'
* 552cc08 Notes added by 'git notes add'