Skip to main content

Sign in

Save your progress and access it from any device.

Or with email

Don't have an account?

Privacy policy

Git notes: annotate your commits

git notes adds annotations to your commits without modifying them. Ideal for code review tracking, deployment info, or any additional context.

Annotation

What is git notes?

git notes lets you add annotations to commits without changing their hash. Notes are stored separately from the history.

It is like sticking a post-it on a commit: you add extra context (review, deployment, related bug) without touching the original commit.

Git notes syntax

git notes add -m "text"

Add a note to the latest commit

git notes show <hash>

Display a commit's note

git notes remove <hash>

Remove a note

Git notes in practice

Adding and managing annotations.

Adding a note

Managing notes

When to use git notes?

Code review

Annotate commits with review status (approved, changes requested) without modifying the history.

Deployment

Mark commits with deployment info (date, environment, version) for traceability.

Documentation

Add extra context to old commits: links to tickets, technical explanations, etc.

Common mistakes with git notes

Forgetting to push notes

Notes are not pushed by default. Use git push origin refs/notes/commits to share them with your team.

Losing notes during a rebase

A rebase changes commit hashes. Notes are linked to the old hashes and do not follow automatically. Use git notes copy to reassign them.

Overwriting an existing note

By default, git notes add refuses to overwrite an existing note. Use -f to force, or git notes append to add to the existing note.

Part of the Git Advanced guide

A

GitQuest is created by Anaïs (nouvelle fenêtre), web developer and head of education, specializing in tech training and digital accessibility.

Questions about git notes

Document your history with GitQuest

Learn to enrich your Git history with annotations and context.

Start the investigations