How to fix error: No note found for object abc1234 in Git

GitINTERMEDIATELOWUpdated Dec 6, 2025ยท 145 views

This error occurs when you try to view or manipulate a Git note for a commit that has no note attached, or when the note is stored in a different notes ref than expected. The fix involves specifying the correct notes reference or creating a note first.

Quick fix

Fixes error: No note found for object abc1234

# List all notes refs
git for-each-ref refs/notes

# Or check the notes directory directly
ls .git/refs/notes/
  1. List all notes refs in the repository
  2. Specify the correct notes ref
  3. Fetch notes from remote repository
  4. Create a note if none exists
git โ€” error
# List all notes refs
git for-each-ref refs/notes
# Or check the notes directory directly
ls .git/refs/notes/
error: No note found for object abc1234

What this error means

Git notes are a way to attach additional information to commits without modifying the commits themselves. They're stored separately from the commit history in special references (typically `refs/notes/commits`). When you see "No note found for object", Git is telling you that no note exists for the specified commit in the notes reference being queried. This error commonly appears in several scenarios: 1. **No note was ever created**: The commit simply doesn't have a note attached to it. Notes must be explicitly added using `git notes add`. 2. **Notes are in a different reference**: Git supports multiple notes namespaces (like `refs/notes/commits`, `refs/notes/review`, `refs/notes/bugs`). The `git notes show` command only looks at the default notes ref unless you specify otherwise with `--ref`. 3. **Notes weren't fetched from remote**: Unlike branches and tags, notes are not fetched by default when you clone or pull a repository. They must be explicitly fetched. 4. **Configuration mismatch**: `git log` may show notes from multiple refs (via `notes.displayRef` configuration), but `git notes show` only checks the default ref unless told otherwise.

Typical symptoms

  • Running 'git notes show <commit>' fails with 'No note found for object'
  • git log displays notes but git notes show returns an error
  • Notes visible in one repository but not after cloning
  • Notes appear in git log --notes=* but not in git notes commands
  • CI/CD pipelines fail when trying to read notes from commits
  • Gerrit or code review notes not accessible after fetching

Common causes

  1. No note exists for the specified commit object
  2. Notes are stored in a different ref namespace (e.g., refs/notes/review instead of refs/notes/commits)
  3. Notes were not fetched from the remote repository
  4. Using git notes show without specifying the correct --ref option
  5. notes.displayRef is configured for git log but git notes uses a different default
  6. The note was removed or never created in the first place

How to fix "error: No note found for object abc1234"

1List all notes refs in the repository

First, check which notes references exist in your repository:

bash
# List all notes refs
git for-each-ref refs/notes

# Or check the notes directory directly
ls .git/refs/notes/

Example output:

bash
abc1234 commit refs/notes/commits
def5678 commit refs/notes/review

This shows you which notes namespaces are available. Common namespaces include:
- refs/notes/commits - Default namespace for general notes
- refs/notes/review - Used by Gerrit for code review data
- refs/notes/bugs - Custom namespace for bug tracking info

If no refs exist, notes may not have been created or fetched yet.

2Specify the correct notes ref

If your notes are stored in a non-default namespace, specify it with the --ref option:

bash
# Show note from a specific ref
git notes --ref=review show HEAD
git notes --ref=bugs show abc1234

# List notes from a specific ref
git notes --ref=review list

Find which ref contains your note:

bash
# Check each known ref for notes on a commit
for ref in $(git for-each-ref --format='%(refname:short)' refs/notes/); do
  echo "Checking $ref:"
  git notes --ref="$ref" show HEAD 2>/dev/null && break
done

Configure git log to show notes from all refs:

bash
# Temporary: show notes from all refs
git log --notes='*'

# Permanent: configure displayRef
git config --add notes.displayRef refs/notes/review
git config --add notes.displayRef refs/notes/bugs
3Fetch notes from remote repository

Notes are not fetched by default. You need to explicitly fetch them:

bash
# Fetch all notes from origin
git fetch origin refs/notes/*:refs/notes/*

# Fetch a specific notes ref
git fetch origin refs/notes/commits:refs/notes/commits
git fetch origin refs/notes/review:refs/notes/review

Configure automatic fetching of notes:

Add to your .git/config or run:

bash
git config --add remote.origin.fetch '+refs/notes/*:refs/notes/*'

After fetching, verify the notes:

bash
# List all notes
git notes list

# Show note for specific commit
git notes show HEAD

For Gerrit users: Gerrit stores review data in notes. Fetch them with:

bash
git fetch origin refs/notes/review:refs/notes/review
git log --notes=review
4Create a note if none exists

If you want to add a note to a commit, use git notes add:

bash
# Add a note to HEAD
git notes add -m "This is a note for the current commit"

# Add a note to a specific commit
git notes add -m "Important fix for issue #123" abc1234

# Add a note interactively (opens editor)
git notes add HEAD

Verify the note was created:

bash
# Show the note
git notes show HEAD

# See the note in git log
git log -1

Output with a note:

bash
commit abc1234...
Author: Developer <dev@example.com>
Date:   Mon Dec 2 10:00:00 2024

    Add new feature

Notes:
    This is a note for the current commit

Add notes to a custom namespace:

bash
git notes --ref=bugs add -m "Related to BUG-456" HEAD
git notes --ref=bugs show HEAD
5Handle notes in scripts and automation

When working with notes in CI/CD or scripts, handle the case where notes don't exist:

Check if a note exists before reading:

bash
# Check if note exists (returns 0 if found, non-zero otherwise)
if git notes show HEAD 2>/dev/null; then
  echo "Note found"
else
  echo "No note for this commit"
fi

Get note content or default value:

bash
# Get note or empty string
NOTE=$(git notes show HEAD 2>/dev/null || echo "")

# Get note or create one
NOTE=$(git notes show HEAD 2>/dev/null) || {
  git notes add -m "Auto-generated note"
  NOTE=$(git notes show HEAD)
}

List commits with notes:

bash
# Get all objects that have notes
git notes list

# Format: <note-object-sha> <annotated-object-sha>
# 1234abc 5678def
# 9876fed 4321cba

Check multiple notes refs in a script:

bash
#!/bin/bash
COMMIT=${1:-HEAD}
for ref in commits review bugs custom; do
  NOTE=$(git notes --ref="$ref" show "$COMMIT" 2>/dev/null)
  if [ -n "$NOTE" ]; then
    echo "Found in refs/notes/$ref:"
    echo "$NOTE"
    exit 0
  fi
done
echo "No notes found for $COMMIT"
6Push notes to remote repository

After creating or modifying notes, you need to push them explicitly:

bash
# Push default notes ref
git push origin refs/notes/commits

# Push all notes refs
git push origin 'refs/notes/*'

# Push a specific notes ref
git push origin refs/notes/review

Set up automatic pushing:

bash
# Configure push refspec for notes
git config --add remote.origin.push '+refs/notes/*:refs/notes/*'

Force push notes (use with caution):

bash
# If notes diverged, you may need to force push
git push --force origin refs/notes/commits

Warning: Force pushing notes can overwrite others' annotations. Coordinate with your team if sharing notes.

7Verify the fix

After applying the appropriate fix, verify notes work correctly:

bash
# List all notes refs
git for-each-ref refs/notes

# List all notes in default ref
git notes list

# Show note for HEAD
git notes show HEAD

# View notes in log output
git log -3 --notes

# View notes from all refs
git log -3 --notes='*'

Test creating and viewing a note:

bash
# Create a test note
git notes add -m "Test note" HEAD

# Verify it shows
git notes show HEAD

# Clean up (optional)
git notes remove HEAD

If issues persist:

1. Check Git version: git --version (notes support varies)
2. Verify repository integrity: git fsck
3. Check for corrupted refs: git for-each-ref refs/notes
4. Inspect the notes ref directly: git log refs/notes/commits

Advanced notes

### Understanding Git Notes Architecture

Git notes are stored as a separate tree that maps object SHAs to note content. The notes ref (e.g., refs/notes/commits) points to a commit whose tree contains the notes data:

bash
# View the notes tree structure
git ls-tree refs/notes/commits

# Notes use a sharded directory structure for performance:
# ab/cd1234...  (first 2 chars / rest of SHA)

### Notes and Repository Cloning

When cloning a repository, notes are NOT included by default:

bash
# Clone with notes
git clone --origin origin <url>
cd <repo>
git fetch origin refs/notes/*:refs/notes/*

For automation/CI, configure in `.gitconfig`:

ini
[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    fetch = +refs/notes/*:refs/notes/*

### Common Notes Ref Conventions

| Namespace | Usage |
|-----------|-------|
| refs/notes/commits | Default, general-purpose notes |
| refs/notes/review | Gerrit code review data |
| refs/notes/amend | Amendment history tracking |
| refs/notes/rewrite | Rebase/cherry-pick tracking |

### Notes Merge Strategies

When notes conflict (e.g., multiple developers adding notes):

bash
# Merge notes from another ref
git notes merge refs/notes/commits

# Available strategies:
git notes merge -s manual    # Manual resolution (default)
git notes merge -s ours      # Keep local notes
git notes merge -s theirs    # Accept remote notes
git notes merge -s union     # Concatenate both
git notes merge -s cat_sort_uniq  # Combine, sort, deduplicate

### Performance Considerations

For repositories with many notes, consider:

1. Fanout structure: Git automatically uses a hierarchical storage when notes exceed certain thresholds
2. Pruning orphaned notes: git notes prune removes notes for objects that no longer exist
3. Separate clones: For CI systems that only need notes temporarily, fetch into a detached refs namespace

### Integration with Code Review Systems

Gerrit: Stores extensive review metadata in notes. After fetching:

bash
git fetch origin refs/notes/review:refs/notes/review
git log --notes=review

GitHub/GitLab: Don't use notes for PR/MR data (they use their API instead). Notes pushed to these platforms are preserved but not displayed in the web UI.

### Debugging Notes Issues

bash
# Show the note object for a commit
git notes list HEAD

# Show the note commit history
git log refs/notes/commits

# Diff notes between refs
git diff refs/notes/commits refs/notes/review

# Find orphaned notes
git notes prune -n  # Dry run
git notes prune     # Actually remove

Frequently asked questions

What does "error: No note found for object abc1234" mean?
Git notes are a way to attach additional information to commits without modifying the commits themselves. They're stored separately from the commit history in special references (typically refs/notes/commits). When you see "No note found for object", Git is telling you that no note exists for the specified commit in the notes reference being queried.
How do I fix "error: No note found for object abc1234"?
This error occurs when you try to view or manipulate a Git note for a commit that has no note attached, or when the note is stored in a different notes ref than expected. The fix involves specifying the correct notes reference or creating a note first.
What causes "error: No note found for object abc1234"?
No note exists for the specified commit object Notes are stored in a different ref namespace (e.g., refs/notes/review instead of refs/notes/commits) Notes were not fetched from the remote repository
Is the "error: No note found for object abc1234" error serious?
It is a low-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading