Skip to content

findReference

Lookup a reference to one of the objects in a repository.

Signature

ts
class Repository {
  findReference(name: string): Reference | null;
}

Parameters

  • namerequired · string

    Reference name to lookup.

Returns

  • null | Reference

    Returns null if the reference does not exist.

Examples

Get HEAD reference from the repository.

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

const repo = await openRepository('.');
const reference = repo.findReference('HEAD');

Released under the MIT License.