Skip to content

Reference

import { /* ... */ } from 'git-edge';
threeWayMerge(repo: Repo, sourceRef: string, targetRef: string, opts?: MergeOpts): Promise<MergeResult>
ParameterTypeDescription
opts.message?stringDefault `Merge ${sourceRef} into ${targetRef}`.
opts.authorName?stringDefault "Git Edge".
opts.authorEmail?stringDefault "git-edge@local".

Returns: Promise<{ commitOid: string }>

Object-level three-way merge — no worktree. Throws GitMergeConflictError on unresolved content conflicts. See Three-way merge for the full decision tree.

createParsedObjectCache(options?: ParsedObjectCacheOptions): ParsedObjectStore
ParameterTypeDescription
options.maxSize?numberApproximate byte budget; each entry is sized by walking its value (no serialization). Default 256 MiB.
options.ttl?numberEntry TTL in ms. Default 1 hour.

Returns: ParsedObjectStore

A generic in-memory LRU for any JS value, keyed however you like. See the parsed-object cache guide.

ParsedObjectStore — the returned interface:

interface ParsedObjectStore {
get<T extends object>(key: string): T | null;
set<T extends object>(key: string, value: T): void;
delete(key: string): void;
invalidatePrefix(prefix: string): void;
}
functiongetRepoCache
getRepoCache(ownerKey: string, repoName: string): object

Returns: object

The long-lived isomorphic-git packfile cache for a repo, created on first access. See Repo cache.

invalidateRepoCache(ownerKey: string, repoName: string): void

Drops a repo’s cached packfile state — call after any out-of-process storage rewrite.

class GitEdgeError extends Error

Base class for every error this package throws.

class GitMergeConflictError extends GitEdgeError

Thrown only by threeWayMerge. Carries conflictingPaths: string[].

Export Shape
Repo { fs: IsoGitFs; gitdir: string; cache?: object }
MergeOpts { message?, authorName?, authorEmail? }
MergeResult { commitOid: string }
ParsedObjectCacheOptions { maxSize?: number; ttl?: number }