Skip to content

squashMergeLocal

squashMergeLocal(repoPath, branch, base, versionProbe?): Promise<void>

Defined in: src/forge/local.ts:214

Off-working-tree squash-merge of branch into base in repoPath, with NO checkout of the base in the primary worktree required.

ORDER IS LOAD-BEARING — the shared base ref is moved only AFTER the base-checkout strategy is decided, and ONLY ONE of the three strategies runs:

  • base checked out in a worktree, clean, HEAD === baseTip → advance it via git -C <wt> merge --ff-only <newCommit> (ref + index + files atomically; no bare update-ref, no desync). This is the headline case.
  • base checked out but dirty, or its HEAD !== baseTip → throw BaseCheckoutBusyError having moved NOTHING.
  • base checked out nowhere → git update-ref refs/heads/<base> <newCommit> <baseTip> (3-arg compare-and-swap; a stale baseTip lets it throw).

A conflict (merge-tree non-zero) throws MergeConflictError before any ref moves.

string

string

string

GitVersionProbe = defaultVersionProbe

Promise<void>