Skip to content

notes

Creates a new iterator for notes in this repository.

The notesRef argument is the canonical name of the reference to use, defaulting to "refs/notes/commits".

Signature

ts
class Repository {
  notes(noteRef?: string | null | undefined): Notes;
}

Parameters

  • notesRefnull | string

Returns

  • Notes

    Iterator of all notes. The iterator returned yields pairs of [string, string]
    where first element is the id of the note and the second id is the id the note is annotating.

Examples

ts
import { openRepository } from 'es-git';

const repo = await openRepository('.');
for (const value of repo.notes()) {
  const [noteId, annotatedId] = value;
  const note = repo.getNote(noteId);
  const commit = repo.getCommit(annotatedId);
}

Released under the MIT License.