@zuke/git
`@zuke/git` — typed `git` task wrappers for Zuke builds.
@zuke/git on JSR ↗ 73 symbols
Symbols
class GitAddSettings extends GitSettings Settings for git add.
| Member | Signature | Doc |
|---|---|---|
paths | paths(...values: PathLike[]): this | Paths/pathspecs to stage (positional); repeatable. |
all | all(): this | Stage all changes including new files (-A/--all). |
update | update(): this | Stage modifications and deletions, but not new files (-u/--update). |
force | force(): this | Stage files git would otherwise ignore (-f/--force). |
intentToAdd | intentToAdd(): this | Record the paths' existence but not their contents (-N/--intent-to-add), which is what makes an untracked file show up in git diff. |
class GitApplySettings extends GitSettings Settings for git apply.
| Member | Signature | Doc |
|---|---|---|
patches | patches(...values: PathLike[]): this | The patch files to apply (positional); repeatable. Reads stdin when empty. |
check | check(): this | Report whether the patch would apply, changing nothing (--check). |
reverse | reverse(): this | Apply the patch backwards (--reverse). |
threeWay | threeWay(): this | Fall back to a three-way merge when the patch does not apply cleanly (--3way), leaving conflict markers instead of refusing outright. |
index | index(): this | Apply to the index as well as the working tree (--index). |
cached | cached(): this | Apply to the index only, leaving the working tree alone (--cached). |
strip | strip(components: number): this | Strip this many leading path components (-p<n>); git's default is 1. |
whitespace | whitespace(action: nowarn | warn | fix | error | error-all): this | What to do about whitespace errors (--whitespace=<action>): nowarn, warn, fix, error, or error-all. |
exclude | exclude(...patterns: string[]): this | Skip files matching this pattern (--exclude=<pattern>); repeatable. |
class GitArchiveSettings extends GitSettings Settings for git archive.
| Member | Signature | Doc |
|---|---|---|
treeish | treeish(rev: string): this | The tree, commit, or tag to archive (positional, required). |
format | format(name: string): this | The archive format (--format=<fmt>), e.g. tar, tar.gz, or zip. |
output | output(path: PathLike): this | Write to this file (--output=<file>) instead of stdout. |
prefix | prefix(value: string): this | Prepend this path to every entry (--prefix=<prefix>/). |
remote | remote(nameOrUrl: string): this | Ask a remote repository for the archive (--remote=<repo>). |
paths | paths(...values: PathLike[]): this | Archive only these pathspecs (positional); repeatable. |
interface GitBlameLine One annotated line of git blame --porcelain.
| Member | Signature | Doc |
|---|---|---|
commit | commit: string | The commit that last touched this line. |
lineNumber | lineNumber: number | The line number in the file as it is now, 1-based. |
originalLineNumber | originalLineNumber: number | The line number in the commit the content came from, 1-based. |
content | content: string | The line's content, without its terminator. |
author? | author?: string | The author's name, as recorded on the commit. |
authorMail? | authorMail?: string | The author's email address, with the angle brackets removed. |
summary? | summary?: string | The commit's subject line. |
filename? | filename?: string | The file the line came from, which differs from the target after a rename. |
class GitBlameSettings extends GitSettings Settings for git blame.
| Member | Signature | Doc |
|---|---|---|
file | file(path: PathLike): this | The file to annotate (positional). |
porcelain | porcelain(): this | Machine-readable output (--porcelain). Prefer "./git.ts".GitTasks.blameLines, which parses it. |
linePorcelain | linePorcelain(): this | Like porcelain, but repeating the commit header on every line (--line-porcelain) rather than only its first appearance. |
revision | revision(value: string): this | Annotate the file as of this revision (positional). |
lineRange | lineRange(start: number, end: number | string): this | Annotate only these lines (-L <start>,<end>); repeatable. |
showEmail | showEmail(): this | Show the author's email rather than their name (-e). |
ignoreWhitespace | ignoreWhitespace(): this | Ignore whitespace-only changes when assigning blame (-w). |
reverse | reverse(value: string): this | Walk history forward from this revision instead (--reverse <rev>). |
ignoreRevs | ignoreRevs(...revisions: string[]): this | Ignore a revision when assigning blame (--ignore-rev); repeatable. |
class GitBranchSettings extends GitSettings Settings for git branch.
| Member | Signature | Doc |
|---|---|---|
name | name(value: string): this | The branch name to create or operate on. |
startPoint | startPoint(rev: string): this | The commit a created branch forks from (git's trailing <start-point>), e.g. origin/main. |
deleteBranch | deleteBranch(force?: boolean): this | Delete the branch (-d, or -D when forced). |
rename | rename(newName: string, force?: boolean): this | Rename name to newName (-m, or -M when forced). |
setUpstreamTo | setUpstreamTo(ref: string): this | Point the branch's upstream at this ref (--set-upstream-to=<ref>). |
all | all(): this | List both local and remote-tracking branches (-a/--all). |
remotes | remotes(): this | List remote-tracking branches only (-r/--remotes). |
contains | contains(rev: string): this | List only branches containing this commit (--contains <commit>). |
merged | merged(ref: string): this | List only branches already merged into this ref (--merged <ref>) — the listing a cleanup target filters stale branches from. |
format | format(spec: string): this | Render a listing through a format string (--format=<fmt>), e.g. %(refname:short) for bare branch names with no * marker or padding. |
sort | sort(key: string): this | Order a listing (--sort=<key>), e.g. -committerdate for most recent first. |
type GitCatFileQuery = type | size | exists The object attribute git cat-file should report instead of contents.
class GitCatFileSettings extends GitSettings Settings for git cat-file.
| Member | Signature | Doc |
|---|---|---|
object | object(value: string): this | The object to read (positional), e.g. "HEAD:deno.json". |
query | query(kind: GitCatFileQuery): this | Report an attribute rather than the contents: type (-t), size (-s), or exists (-e, which answers by exit status and prints nothing). |
textconv | textconv(): this | Run the object through its textconv filter (--textconv). |
filters | filters(): this | Run the object through its working-tree filters (--filters). |
class GitCheckIgnoreSettings extends GitSettings Settings for git check-ignore.
| Member | Signature | Doc |
|---|---|---|
quietOutput | quietOutput(): this | Say nothing and answer by exit status alone (-q). Named apart from the inherited quiet, which silences Zuke's echo of the command rather than git's output. |
verbose | verbose(): this | Also report the rule that excluded each path (-v). |
nonMatching | nonMatching(): this | Include the paths that are *not* excluded (-n); needs verbose. |
noIndex | noIndex(): this | Ignore the index when checking (--no-index). |
nulTerminated | nulTerminated(): this | Terminate records with NUL rather than newline (-z). |
paths | paths(...values: string[]): this | The paths to check (positional); repeatable. |
class GitCheckoutSettings extends GitSettings Settings for git checkout.
| Member | Signature | Doc |
|---|---|---|
ref | ref(target: string): this | The branch or commit to check out — or, with paths, the source to restore those paths from. Required unless paths is given. |
paths | paths(...paths: string[]): this | Restore one or more paths (git checkout [<ref>] -- <paths>). The -- separates paths from any ref so a path is never misread as a branch name; repeatable. With no ref, restores the paths from the index (discarding working-tree changes). |
create | create(): this | Create a new branch (-b). |
detach | detach(): this | Check the ref out with a detached HEAD (--detach). |
force | force(): this | Force checkout, discarding local changes (-f/--force). |
class GitCherryPickSettings extends GitReplaySettings Settings for git cherry-pick.
| Member | Signature | Doc |
|---|---|---|
allowEmpty | allowEmpty(): this | Keep a commit that produces no changes (--allow-empty). |
ff | ff(): this | Fast-forward instead of rewriting when the parent matches HEAD (--ff). |
class GitCleanSettings extends GitSettings Settings for git clean.
| Member | Signature | Doc |
|---|---|---|
paths | paths(...values: PathLike[]): this | Limit the clean to these pathspecs (positional); repeatable. |
force | force(): this | Actually delete the files (-f/--force). |
dryRun | dryRun(): this | List what would be deleted without deleting it (-n/--dry-run). |
directories | directories(): this | Also remove untracked directories (-d). |
includeIgnored | includeIgnored(): this | Remove ignored files too (-x) — the switch that turns a clean into a from-scratch build, since node_modules and target/ are ignored. |
onlyIgnored | onlyIgnored(): this | Remove *only* ignored files (-X), keeping other untracked ones. |
exclude | exclude(...patterns: string[]): this | Spare paths matching this pattern (--exclude=<pattern>); repeatable. |
class GitCloneSettings extends GitSettings Settings for git clone.
| Member | Signature | Doc |
|---|---|---|
repository | repository(url: string): this | The repository URL to clone (required). |
directory | directory(path: PathLike): this | Target directory for the clone. |
branch | branch(name: string): this | Check out a specific branch (-b/--branch). |
depth | depth(commits: number): this | Create a shallow clone of the given depth (--depth). |
bare | bare(): this | Clone a bare repository (--bare). |
filter | filter(spec: string): this | Partial-clone filter (--filter=<spec>), e.g. blob:none for a treeless clone that fetches blobs on demand — the cheap way to get full history in CI without the file contents of every revision. |
singleBranch | singleBranch(): this | Clone only the history of the checked-out branch (--single-branch). |
recurseSubmodules | recurseSubmodules(): this | Also clone submodules (--recurse-submodules). |
interface GitCommitEntry One commit of "./git.ts".GitTasks.logEntries.
| Member | Signature | Doc |
|---|---|---|
commit | commit: string | The full commit SHA (%H). |
shortCommit | shortCommit: string | The abbreviated commit SHA (%h). |
parents | parents: string[] | The parent SHAs (%P); two or more mean a merge, none the root commit. |
authorName | authorName: string | The author's name (%an). |
authorEmail | authorEmail: string | The author's email (%ae). |
authoredAt | authoredAt: string | When the commit was authored, ISO 8601 (%aI). |
committedAt | committedAt: string | When the commit was committed, ISO 8601 (%cI). |
subject | subject: string | The first line of the message (%s). |
body | body: string | The rest of the message (%B after the subject), trailing newlines trimmed. |
class GitCommitSettings extends GitSettings Settings for git commit.
| Member | Signature | Doc |
|---|---|---|
message | message(text: string): this | The commit message (-m). |
all | all(): this | Stage modified/deleted files before committing (-a/--all). |
amend | amend(): this | Amend the previous commit (--amend). |
noEdit | noEdit(): this | Keep the existing message when amending (--no-edit). |
allowEmpty | allowEmpty(): this | Allow a commit with no changes (--allow-empty). |
noVerify | noVerify(): this | Skip the pre-commit and commit-msg hooks (--no-verify) — what a bot commit wants when the hooks are meant for humans at a terminal. |
author | author(value: string): this | Attribute the commit to someone else (--author="Name <email>"). |
paths | paths(...values: PathLike[]): this | Commit only these pathspecs (positional); repeatable. |
class GitConfigSettings extends GitSettings Settings for git config. Pick the operation with get, getAll, set, add, unset, or list, and the file with global, local, system, worktree, or file.
| Member | Signature | Doc |
|---|---|---|
get | get(key: string): this | Read a key's value (--get <key>). |
getAll | getAll(key: string): this | Read every value of a multi-valued key (--get-all <key>). |
set | set(key: string, value: string): this | Set a key, replacing any existing value (git config <key> <value>). |
add | add(key: string, value: string): this | Add another value to a multi-valued key (--add <key> <value>). |
unset | unset(key: string): this | Remove a key (--unset <key>). |
list | list(): this | List every configured key (--list). |
global | global(): this | Use the user's configuration (--global). |
local | local(): this | Use the repository's configuration (--local). |
system | system(): this | Use the machine's configuration (--system). |
worktree | worktree(): this | Use the worktree's configuration (--worktree). |
file | file(path: PathLike): this | Use a specific file (--file <path>), rather than one of the scopes. |
defaultValue | defaultValue(value: string): this | What to report when the key is unset (--default <value>), which also makes --get exit 0 instead of 1. |
class GitDefaultBranchSettings extends GitSettings Settings for "./git.ts".GitTasks.defaultBranch: which remote to ask, plus the global options every git task shares.
| Member | Signature | Doc |
|---|---|---|
remote | remote(name: string): this | The remote whose default branch is wanted (default origin). |
remoteName | remoteName(): string | The remote being asked — the prefix the local ref reports it under. |
askRemote_ | askRemote_: boolean | Ask the remote itself rather than reading the local ref. Set by the task for its fallback attempt; a caller has no reason to set it, since the task already tries both in the order that avoids the network when it can. |
class GitDescribeSettings extends GitSettings Settings for git describe.
| Member | Signature | Doc |
|---|---|---|
commitish | commitish(rev: string): this | The commit to describe (positional); defaults to HEAD. |
tags | tags(): this | Consider lightweight tags too, not only annotated ones (--tags). |
all | all(): this | Consider every ref, not only tags (--all). |
always | always(): this | Fall back to an abbreviated SHA when no tag matches (--always). |
exactMatch | exactMatch(): this | Fail unless the commit is exactly at a tag (--exact-match). |
abbrev | abbrev(length: number): this | How many SHA characters to append (--abbrev=<n>). 0 suppresses the suffix entirely, which is how a build reads the nearest tag's bare name. |
dirty | dirty(suffix?: string): this | Append a marker when the working tree is dirty (--dirty[=<suffix>]). |
match | match(...patterns: string[]): this | Only consider tags matching this glob (--match <pattern>); repeatable. |
class GitDiffSettings extends GitSettings Settings for git diff.
| Member | Signature | Doc |
|---|---|---|
commits | commits(...revs: string[]): this | The commits to compare (positional); repeatable. One rev diffs the working tree against it; two diff them against each other. |
mergeBase | mergeBase(from: string, to?: string): this | Compare the two ends of a range — from...to with three dots, which diffs to against the point the two branches last shared. That is the diff a pull request shows, and the one a review or an "affected" check wants, since it excludes whatever landed on the base branch meanwhile. |
paths | paths(...values: PathLike[]): this | Limit the diff to these pathspecs (positional, after --); repeatable. |
staged | staged(): this | Diff the index against HEAD rather than the working tree (--staged). |
nameOnly | nameOnly(): this | List the changed paths instead of the patch (--name-only). |
nameStatus | nameStatus(): this | List the changed paths with their status letters (--name-status). |
stat | stat(): this | Summarise the changes per file (--stat). |
shortstat | shortstat(): this | One summary line for the whole diff (--shortstat). |
unified | unified(lines: number): this | Lines of context around each hunk (--unified=<n>). |
ignoreAllSpace | ignoreAllSpace(): this | Ignore whitespace entirely when comparing (--ignore-all-space). |
exitCode | exitCode(): this | Report differences through the exit code (--exit-code): 1 when there are any, 0 when there are none. Pair it with .noThrow() to branch on output.code instead of catching. |
diffFilter | diffFilter(letters: string): this | Keep only files whose change matches these status letters (--diff-filter=<letters>), e.g. ACM for added, copied, and modified — how a lint target skips paths the diff only deleted. |
nulTerminated | nulTerminated(): this | Terminate output records with a NUL rather than a newline (-z). |
class GitFetchSettings extends GitSettings Settings for git fetch.
| Member | Signature | Doc |
|---|---|---|
remote | remote(name: string): this | The remote to fetch from. |
refspec | refspec(...specs: string[]): this | Add a refspec to fetch, after the remote — master, or master:refs/remotes/origin/master to also update the remote-tracking ref (which is what makes origin/master resolvable in a shallow CI checkout that never fetched it). Repeatable. Prefix the source with + to force the update. Pair it with depth: a shallow fetch is not a fast-forward of the history already present, and git rejects such an update unless it is forced. |
noTags | noTags(): this | Skip fetching tags (--no-tags). |
depth | depth(commits: number): this | Limit history to this many commits (--depth). 1 is enough to diff against a base branch and avoids pulling a whole history into a CI job. |
unshallow | unshallow(): this | Deepen a shallow clone into the full history (--unshallow) — what a release target needs before git describe or a changelog can see past the one commit CI checked out. |
all | all(): this | Fetch from all remotes (--all). |
tags | tags(): this | Also fetch tags (--tags). |
prune | prune(): this | Prune deleted remote refs (--prune). |
force | force(): this | Update refs even when the update is not a fast-forward (--force). |
class GitForEachRefSettings extends GitSettings Settings for git for-each-ref.
| Member | Signature | Doc |
|---|---|---|
format | format(value: string): this | The output format (--format=<format>), in git's placeholder language. |
count | count(value: number): this | Show only this many matched refs (--count=<n>). |
sort | sort(...keys: string[]): this | Sort by a field (--sort=<key>), e.g. "-creatordate" for newest first; repeatable, and git applies the keys in the order given. |
exclude | exclude(...patterns: string[]): this | Exclude refs matching a pattern (--exclude=<pattern>); repeatable. |
pointsAt | pointsAt(object: string): this | Only refs pointing at this object (--points-at=<object>). |
merged | merged(commit: string): this | Only refs merged into this commit (--merged=<commit>). |
noMerged | noMerged(commit: string): this | Only refs not merged into this commit (--no-merged=<commit>). |
contains | contains(commit: string): this | Only refs whose history contains this commit (--contains=<commit>). |
noContains | noContains(commit: string): this | Only refs not containing this commit (--no-contains=<commit>). |
ignoreCase | ignoreCase(): this | Sort and filter case-insensitively (--ignore-case). |
omitEmpty | omitEmpty(): this | Skip the newline after a ref that formats to nothing (--omit-empty). |
patterns | patterns(...values: string[]): this | The ref patterns to match (positional), e.g. "refs/tags/"; repeatable. |
class GitGrepSettings extends GitSettings Settings for git grep.
| Member | Signature | Doc |
|---|---|---|
pattern | pattern(...values: string[]): this | A pattern to search for (-e <pattern>); repeatable. |
ignoreCase | ignoreCase(): this | Match case-insensitively (-i). |
wordRegexp | wordRegexp(): this | Match only at word boundaries (-w). |
invert | invert(): this | Report the lines that do *not* match (-v). |
lineNumber | lineNumber(): this | Prefix each match with its line number (-n). |
namesOnly | namesOnly(): this | Report only the names of matching files (-l). |
countMatches | countMatches(): this | Report only how many lines matched per file (-c). |
extendedRegexp | extendedRegexp(): this | Read the pattern as a POSIX extended regexp (-E). |
fixedStrings | fixedStrings(): this | Read the pattern as a literal string (-F). |
cached | cached(): this | Search the index rather than the working tree (--cached). |
untracked | untracked(): this | Search untracked files as well as tracked ones (--untracked). |
nulTerminated | nulTerminated(): this | Terminate output records with NUL (-z). |
maxDepth | maxDepth(value: number): this | Descend at most this many directories (--max-depth=<n>). |
context | context(lines: number): this | Show this many lines of context around each match (-C <n>). |
revisions | revisions(...values: string[]): this | Search these revisions rather than the working tree (positional). |
paths | paths(...values: string[]): this | Limit the search to these paths (positional); repeatable. |
async function gitInfo(options?: GitInfoOptions): Promise<GitInfo> Resolve GitInfo for the repository at cwd. Throws if cwd is not a git repository (or git is unavailable). Optional fields (tag, remoteUrl) are undefined when absent.
interface GitInfo Resolved git repository information.
| Member | Signature | Doc |
|---|---|---|
branch | branch: string | Current branch, or "HEAD" when detached. |
commit | commit: string | Full commit SHA of HEAD. |
shortCommit | shortCommit: string | Abbreviated commit SHA. |
tag? | tag?: string | The nearest tag (git describe --tags --abbrev=0), if any. |
dirty | dirty: boolean | Whether the working tree has uncommitted changes. |
remoteUrl? | remoteUrl?: string | The origin remote URL, if configured. |
interface GitInfoOptions Options for gitInfo.
| Member | Signature | Doc |
|---|---|---|
cwd? | cwd?: string | Directory to inspect (defaults to the current directory). |
run? | run?: GitRunner | Override how git is invoked (defaults to spawning git); for testing. |
class GitInitSettings extends GitSettings Settings for git init.
| Member | Signature | Doc |
|---|---|---|
bare | bare(): this | Create a bare repository (--bare). |
initialBranch | initialBranch(name: string): this | Name the initial branch (-b/--initial-branch). |
class GitLogSettings extends GitSettings Settings for git log.
| Member | Signature | Doc |
|---|---|---|
revisions | revisions(...revs: string[]): this | Revisions to walk (positional), e.g. HEAD or origin/main; repeatable. |
range | range(from: string, to?: string): this | Walk the commits in from..to — what is on to and not on from, the range a changelog since the last tag is built from. to defaults to HEAD. |
paths | paths(...values: PathLike[]): this | Limit the walk to these pathspecs (positional, after --); repeatable. |
maxCount | maxCount(count: number): this | Stop after this many commits (--max-count=<n>). |
skip | skip(count: number): this | Skip this many commits before reporting any (--skip=<n>). |
oneline | oneline(): this | One abbreviated line per commit (--oneline). |
format | format(spec: string): this | Render each commit through a format string (--format=<fmt>), e.g. %H %s. Given after oneline, so it wins when both are set. |
since | since(date: string): this | Only commits more recent than this date (--since=<date>). |
until | until(date: string): this | Only commits older than this date (--until=<date>). |
author | author(...patterns: string[]): this | Only commits whose author matches this pattern (--author=); repeatable. |
grep | grep(...patterns: string[]): this | Only commits whose message matches this pattern (--grep=); repeatable. |
noMerges | noMerges(): this | Skip merge commits (--no-merges). |
firstParent | firstParent(): this | Follow only the first parent of a merge (--first-parent). |
reverse | reverse(): this | Report oldest first (--reverse). |
follow | follow(): this | Keep following a single file across renames (--follow). |
class GitLsFilesSettings extends GitSettings Settings for git ls-files.
| Member | Signature | Doc |
|---|---|---|
paths | paths(...values: PathLike[]): this | Limit the listing to these pathspecs (positional); repeatable. |
cached | cached(): this | List files in the index (--cached), git's default. |
modified | modified(): this | List files modified in the working tree (--modified). |
deleted | deleted(): this | List files deleted from the working tree (--deleted). |
others | others(): this | List untracked files (--others). Pair it with excludeStandard, or the listing includes everything .gitignore covers. |
ignored | ignored(): this | List ignored files (--ignored); only meaningful with others. |
stage | stage(): this | Show the mode, object name, and stage of each entry (--stage). |
excludeStandard | excludeStandard(): this | Apply the standard ignore rules (--exclude-standard). |
directory | directory(): this | Report an untracked directory once rather than every file in it (--directory). |
errorUnmatch | errorUnmatch(): this | Exit non-zero when a pathspec matches nothing (--error-unmatch), which is how a build asserts that a path is tracked rather than reading the listing to see whether it came back empty. git only applies it to the paths it was given, so it needs paths — the flag on its own describes a whole-tree listing, which always matches something. |
nulTerminated | nulTerminated(): this | Terminate each entry with a NUL rather than a newline (-z). |
class GitLsRemoteSettings extends GitSettings Settings for git ls-remote.
| Member | Signature | Doc |
|---|---|---|
remote | remote(nameOrUrl: string): this | The remote (or URL) to ask; defaults to the branch's upstream. |
patterns | patterns(...values: string[]): this | Limit the listing to refs matching these patterns (positional); repeatable. |
heads | heads(): this | List branch refs only (--heads). |
tags | tags(): this | List tag refs only (--tags). |
refs | refs(): this | Hide peeled tags and pseudo-refs (--refs). |
symref | symref(): this | Also report what the remote's HEAD points at (--symref). |
exitCode | exitCode(): this | Exit 2 when nothing matched (--exit-code). |
class GitLsTreeSettings extends GitSettings Settings for git ls-tree.
| Member | Signature | Doc |
|---|---|---|
tree | tree(value: string): this | The tree-ish to list (positional), e.g. "HEAD" or "v1.0.0". |
recursive | recursive(): this | Recurse into subtrees (-r). |
treesOnly | treesOnly(): this | Show only trees, not blobs (-d). |
showTrees | showTrees(): this | Show the trees themselves while recursing (-t). |
nulTerminated | nulTerminated(): this | Terminate entries with NUL rather than newline (-z). |
long | long(): this | Include each object's size (--long). |
nameOnly | nameOnly(): this | List only the file names (--name-only). |
objectOnly | objectOnly(): this | List only the object names (--object-only). |
fullName | fullName(): this | Report paths from the repository root (--full-name). |
fullTree | fullTree(): this | List the whole tree, not just the current directory (--full-tree). |
abbrev | abbrev(digits: number): this | Abbreviate object names to this many digits (--abbrev=<n>). |
paths | paths(...values: string[]): this | Limit the listing to these paths (positional); repeatable. |
class GitMergeBaseSettings extends GitSettings Settings for git merge-base.
| Member | Signature | Doc |
|---|---|---|
all | all(): this | Output every common ancestor rather than one (--all). |
octopus | octopus(): this | Find the ancestors for a single n-way merge (--octopus). |
independent | independent(): this | List the revisions not reachable from any other (--independent). |
isAncestor | isAncestor(): this | Ask whether the first commit is an ancestor of the second (--is-ancestor), which git answers by exit status and prints nothing. Prefer "./git.ts".GitTasks.isAncestor, which reads that status back as a boolean. |
forkPoint | forkPoint(): this | Find where a commit forked from a ref's reflog (--fork-point). |
commits | commits(...values: string[]): this | The commits to consider (positional); repeatable. |
class GitMergeSettings extends GitSequencerSettings Settings for git merge.
| Member | Signature | Doc |
|---|---|---|
refs | refs(...values: string[]): this | The commits to merge into the current branch (positional); repeatable. |
message | message(text: string): this | The merge commit's message (-m). |
noFf | noFf(): this | Always create a merge commit (--no-ff), even when a fast-forward would do. |
ffOnly | ffOnly(): this | Refuse anything but a fast-forward (--ff-only). |
squash | squash(): this | Stage the merged result without recording a merge (--squash). |
noCommit | noCommit(): this | Merge but leave the commit to the caller (--no-commit). |
strategy | strategy(name: string): this | The merge strategy (--strategy=<name>), e.g. ours. |
strategyOption | strategyOption(...options: string[]): this | An option for the strategy (--strategy-option=<option>), e.g. theirs to resolve conflicting hunks in favour of the merged branch; repeatable. |
allowUnrelatedHistories | allowUnrelatedHistories(): this | Merge histories that share no commit (--allow-unrelated-histories). |
class GitMergeTreeSettings extends GitSettings Settings for git merge-tree.
| Member | Signature | Doc |
|---|---|---|
writeTree | writeTree(): this | Do a real merge and write the resulting tree (--write-tree), rather than the trivial three-way form. This is the default in git 2.38 and later. |
messages | messages(): this | Also print the informational and conflict messages (--messages). |
nameOnly | nameOnly(): this | List conflicted filenames without modes or object names (--name-only). |
nulTerminated | nulTerminated(): this | Separate paths with NUL rather than newline (-z). |
allowUnrelatedHistories | allowUnrelatedHistories(): this | Permit merging histories with no common ancestor (--allow-unrelated-histories). |
mergeBase | mergeBase(commit: string): this | Use this commit as the merge base (--merge-base=<commit>). |
branches | branches(...values: string[]): this | The two branches to merge (positional). |
class GitMvSettings extends GitSettings Settings for git mv.
| Member | Signature | Doc |
|---|---|---|
sources | sources(...values: PathLike[]): this | The path(s) to move (positional, required); repeatable. |
destination | destination(path: PathLike): this | Where they move to (required): a file name for a single source, a directory when there is more than one. |
force | force(): this | Overwrite an existing destination (-f/--force). |
dryRun | dryRun(): this | Report what would move without moving it (-n/--dry-run). |
class GitNameRevSettings extends GitSettings Settings for git name-rev.
| Member | Signature | Doc |
|---|---|---|
tags | tags(): this | Use only tags to name the commits (--tags). |
all | all(): this | Name every reachable commit (--all). |
nameOnly | nameOnly(): this | Print only the name, not the commit it names (--name-only). |
alwaysName | alwaysName(): this | Fall back to the object name when nothing else names it (--always). |
refs | refs(...patterns: string[]): this | Only consider refs matching these patterns (--refs=<pattern>). |
commits | commits(...values: string[]): this | The commits to name (positional); repeatable. |
class GitPullSettings extends GitSettings Settings for git pull.
| Member | Signature | Doc |
|---|---|---|
remote | remote(name: string): this | The remote to pull from. |
ref | ref(value: string): this | The refspec/branch to pull. |
rebase | rebase(): this | Rebase instead of merge (--rebase). |
noRebase | noRebase(): this | Merge rather than rebase (--no-rebase), whatever pull.rebase is set to in the ambient config — the flag a build reaches for when it must not depend on the machine it runs on. |
ffOnly | ffOnly(): this | Only fast-forward (--ff-only). |
depth | depth(commits: number): this | Limit the fetched history to this many commits (--depth). |
tags | tags(): this | Also fetch tags (--tags). |
prune | prune(): this | Prune deleted remote refs while fetching (--prune). |
class GitPushSettings extends GitSettings Settings for git push.
| Member | Signature | Doc |
|---|---|---|
remote | remote(name: string): this | The remote to push to (e.g. origin). |
ref | ref(value: string): this | The refspec/branch to push. |
setUpstream | setUpstream(): this | Set the upstream tracking ref (-u/--set-upstream). |
tags | tags(): this | Also push tags (--tags). |
followTags | followTags(): this | Push the annotated tags reachable from the refs being pushed (--follow-tags) — a release target's tag rides along with its commit instead of needing a second push. |
forceWithLease | forceWithLease(): this | Force push, but only if the remote ref is unchanged (--force-with-lease). |
deleteRef | deleteRef(): this | Delete the remote ref (--delete). |
atomic | atomic(): this | Update every ref or none (--atomic). |
dryRun | dryRun(): this | Report what would be pushed without pushing it (--dry-run). |
pushOption | pushOption(...values: string[]): this | Send a server-side option (--push-option=<value>); repeatable. GitLab reads these for ci.skip and merge-request creation. |
class GitRebaseSettings extends GitSequencerSettings Settings for git rebase.
| Member | Signature | Doc |
|---|---|---|
upstream | upstream(rev: string): this | The commit the current branch is replayed onto (positional). |
branch | branch(name: string): this | Rebase this branch rather than the checked-out one (git's <branch>). |
onto | onto(rev: string): this | Replay onto a different base than the upstream (--onto <newbase>). |
autosquash | autosquash(): this | Fold fixup!/squash! commits into their targets (--autosquash). |
autostash | autostash(): this | Stash local changes and restore them afterwards (--autostash), instead of refusing to start on a dirty tree. |
keepEmpty | keepEmpty(): this | Keep commits that produce no changes (--keep-empty). |
rebaseMerges | rebaseMerges(): this | Recreate merge commits rather than flattening them (--rebase-merges). |
strategy | strategy(name: string): this | The merge strategy used to replay each commit (--strategy=<name>). |
strategyOption | strategyOption(...options: string[]): this | An option for that strategy (--strategy-option=<option>); repeatable. |
skip | skip(): this | Drop the current commit and carry on (--skip). |
interface GitRef One ref from git for-each-ref, as REF_ENTRY_FORMAT reports it.
| Member | Signature | Doc |
|---|---|---|
objectName | objectName: string | The object the ref points at, as a full object name. |
objectType | objectType: string | The kind of object: commit, tag, tree, or blob. |
refName | refName: string | The full ref name, e.g. refs/tags/v1.0.0. |
upstream? | upstream?: string | The upstream this ref tracks, if it has one. |
interface GitRemote One remote of git remote --verbose, with both of its URLs folded in.
| Member | Signature | Doc |
|---|---|---|
name | name: string | The remote's name, e.g. origin. |
fetchUrl? | fetchUrl?: string | Where fetches read from, when the listing reported one. |
pushUrl? | pushUrl?: string | Where pushes write to, when the listing reported one. |
class GitRemoteSettings extends GitSettings Settings for git remote. Pick the subcommand with list, add, remove, rename, setUrl, getUrl, show, or prune.
| Member | Signature | Doc |
|---|---|---|
list | list(): this | List the configured remotes (git remote), the default. |
add | add(name: string, url: string): this | Add a remote (git remote add <name> <url>). |
remove | remove(name: string): this | Remove a remote and its tracking refs (git remote remove <name>). |
rename | rename(oldName: string, newName: string): this | Rename a remote (git remote rename <old> <new>). |
setUrl | setUrl(name: string, url: string): this | Change a remote's URL (git remote set-url <name> <url>). Add pushUrl to change only the push URL. |
getUrl | getUrl(name: string): this | Print a remote's URL (git remote get-url <name>). |
show | show(name: string): this | Describe a remote and its branches (git remote show <name>). |
prune | prune(name: string): this | Delete tracking refs the remote no longer has (git remote prune <name>). |
verbose | verbose(): this | Show each remote's URLs when listing (-v/--verbose). |
fetch | fetch(): this | Fetch from the remote right after adding it (-f, add only). |
track | track(branch: string): this | Track only this branch (-t <branch>, add only). |
pushUrl | pushUrl(): this | Operate on the push URL (--push), for setUrl and getUrl. |
class GitReplaySettings extends GitSequencerSettings Shared base for cherry-pick and revert: the same commit list, the same --no-commit/--mainline, and the same four control flags. Only the subcommand's name and the extra flags differ, which is why they are one implementation rather than two that drift.
| Member | Signature | Doc |
|---|---|---|
commits | commits(...revs: string[]): this | The commits to replay (positional, required); repeatable. |
noCommit | noCommit(): this | Apply the change without committing it (-n/--no-commit). |
mainline | mainline(parent: number): this | Which parent of a merge commit to treat as the mainline (-m <parent-number>), counting from 1. Replaying a merge needs it: git cannot otherwise tell which side of the merge the change is. |
signoff | signoff(): this | Add a Signed-off-by trailer (--signoff). |
skip | skip(): this | Drop the current commit and carry on (--skip). |
class GitResetSettings extends GitSettings Settings for git reset.
| Member | Signature | Doc |
|---|---|---|
ref | ref(rev: string): this | The commit to reset to (positional); defaults to HEAD. |
paths | paths(...values: PathLike[]): this | Reset only these pathspecs — unstaging them (positional); repeatable. |
soft | soft(): this | Move the branch only, keeping the index and working tree (--soft). |
mixed | mixed(): this | Reset the index but not the working tree (--mixed), git's default. |
hard | hard(): this | Reset the index *and* the working tree (--hard), discarding changes. |
merge | merge(): this | Reset, keeping changes to files that differ between the commits (--merge). |
keep | keep(): this | Like merge, but refuse when a changed file differs (--keep). |
class GitRestoreSettings extends GitSettings Settings for git restore.
| Member | Signature | Doc |
|---|---|---|
paths | paths(...values: PathLike[]): this | The pathspecs to restore (positional, required); repeatable. |
source | source(treeish: string): this | Restore the contents from this commit or tree (--source=<tree-ish>) rather than from the index. |
staged | staged(): this | Restore the index (--staged) — unstaging the paths. Combine with worktree to reset both, which is what git restore -SW does. |
worktree | worktree(): this | Restore the working tree (--worktree), git's default when neither is given. |
class GitRevertSettings extends GitReplaySettings Settings for git revert.
| Member | Signature | Doc |
|---|---|---|
noEdit | noEdit(): this | Take the generated message without opening an editor (--no-edit). |
class GitRevListSettings extends GitSettings Settings for git rev-list.
| Member | Signature | Doc |
|---|---|---|
count | count(): this | Print how many commits the walk found rather than listing them (--count). Prefer "./git.ts".GitTasks.commitCount, which reads that number back. |
maxCount | maxCount(value: number): this | Stop after this many commits (--max-count=<n>). |
skip | skip(value: number): this | Skip this many commits before printing (--skip=<n>). |
all | all(): this | Walk every ref in refs/ (--all). |
branches | branches(): this | Walk every branch (--branches). |
tags | tags(): this | Walk every tag (--tags). |
remotes | remotes(): this | Walk every remote-tracking branch (--remotes). |
noMerges | noMerges(): this | Omit merge commits (--no-merges). |
merges | merges(): this | Keep only merge commits (--merges). |
firstParent | firstParent(): this | Follow only the first parent of each merge (--first-parent). |
reverse | reverse(): this | Emit the commits oldest first (--reverse). |
topoOrder | topoOrder(): this | Order by topology rather than date (--topo-order). |
dateOrder | dateOrder(): this | Order by commit date (--date-order). |
since | since(value: string): this | Only commits after this date (--since=<date>). |
until | until(value: string): this | Only commits before this date (--until=<date>). |
author | author(pattern: string): this | Only commits whose author matches (--author=<pattern>). |
commits | commits(...values: string[]): this | The commits or ranges to walk (positional), e.g. "HEAD" or "origin/main..HEAD"; repeatable. |
paths | paths(...values: string[]): this | Limit the walk to commits touching these paths (positional); repeatable. |
class GitRevParseSettings extends GitSettings Settings for git rev-parse.
| Member | Signature | Doc |
|---|---|---|
rev | rev(...values: string[]): this | The revisions or arguments to resolve (positional); repeatable. |
short | short(length?: number): this | Abbreviate the SHA (--short, or --short=<n> with a length). git picks a length long enough to stay unambiguous when none is given. |
abbrevRef | abbrevRef(): this | Print the ref's short name (--abbrev-ref), e.g. main for HEAD. |
verify | verify(): this | Fail rather than echo the argument when it names no object (--verify). |
gitDir | gitDir(): this | Print the path of the .git directory (--git-dir). |
showToplevel | showToplevel(): this | Print the absolute path of the working tree's root (--show-toplevel). |
showPrefix | showPrefix(): this | Print the current directory's path relative to that root (--show-prefix). |
isInsideWorkTree | isInsideWorkTree(): this | Print whether this is inside a working tree (--is-inside-work-tree). |
class GitRmSettings extends GitSettings Settings for git rm.
| Member | Signature | Doc |
|---|---|---|
paths | paths(...values: PathLike[]): this | Paths/pathspecs to remove (positional, required); repeatable. |
cached | cached(): this | Remove from the index only, leaving the file on disk (--cached) — how a file committed by mistake stops being tracked without being deleted. |
recursive | recursive(): this | Recurse into directories (-r). |
force | force(): this | Remove even when the file has staged or local changes (-f/--force). |
dryRun | dryRun(): this | Report what would be removed without removing it (-n/--dry-run). |
ignoreUnmatch | ignoreUnmatch(): this | Exit 0 when no path matches (--ignore-unmatch). |
type GitRunner = unknown Runs a git subcommand and resolves to its trimmed stdout, or null when the command fails (non-zero exit, or git unavailable).
class GitRunSettings extends GitSettings Settings for an arbitrary git command not covered by a typed task.
| Member | Signature | Doc |
|---|---|---|
command | command(...parts: Array<string | number>): this | The subcommand and its arguments, e.g. command("bisect", "start"). |
class GitSequencerSettings extends GitSettings Base for the commands that can be left in progress by a conflict. Subclasses expose only the actions their command accepts — merge has no --skip — and call GitSequencerSettings.sequencer_ to record one.
| Member | Signature | Doc |
|---|---|---|
continue | continue(): this | Resume the operation once the conflict is resolved (--continue). |
abort | abort(): this | Undo it and restore the pre-operation state (--abort). |
quit | quit(): this | Forget the operation, leaving the tree as it is (--quit). |
class GitSettings extends ToolSettings Shared base for every git subcommand: the binary and global options.
| Member | Signature | Doc |
|---|---|---|
dir | dir(path: PathLike): this | Run git as if started in path (-C <path>). |
config | config(key: string, value: string): this | Set a one-off config value (-c key=value); repeatable. |
interface GitShortlogEntry One line of git shortlog -s: a contributor and how many commits they have.
| Member | Signature | Doc |
|---|---|---|
count | count: number | How many commits the group holds. |
name | name: string | The contributor's name, as recorded on the commits. |
email? | email?: string | Their email address; present only when -e asked for it. |
class GitShortlogSettings extends GitSettings Settings for git shortlog.
| Member | Signature | Doc |
|---|---|---|
summary | summary(): this | Report only the commit count per author, without the subjects (-s). Prefer "./git.ts".GitTasks.shortlogEntries, which reads that output back. |
numbered | numbered(): this | Sort by commit count rather than by name (-n). |
email | email(): this | Include each author's email address (-e). |
committer | committer(): this | Group by committer rather than author (-c). |
group | group(...fields: string[]): this | Group by a named field (--group=<field>), e.g. "trailer:co-authored-by". |
commits | commits(...values: string[]): this | The revision range to summarise (positional); repeatable. |
paths | paths(...values: string[]): this | Limit the summary to commits touching these paths (positional). |
class GitShowRefSettings extends GitSettings Settings for git show-ref.
| Member | Signature | Doc |
|---|---|---|
tags | tags(): this | Only tags (--tags); may be combined with heads. |
heads | heads(): this | Only branch heads (--heads); may be combined with tags. |
head | head(): this | Include HEAD even when a filter would exclude it (--head). |
dereference | dereference(): this | Dereference tags into the objects they point at (--dereference). |
hash | hash(): this | Print only the object name, without the ref (--hash). |
verify | verify(): this | Require an exact ref path and fail otherwise (--verify). |
exists | exists(): this | Check a ref exists without resolving it (--exists). |
quietOutput | quietOutput(): this | Suppress git's own stdout (--quiet), leaving the exit status as the answer — the useful pairing with verify. Named apart from the inherited quiet, which silences Zuke's echo of the command rather than git's output. |
abbrev | abbrev(digits: number): this | Abbreviate object names to this many digits (--abbrev=<n>). |
patterns | patterns(...values: string[]): this | The ref patterns to show (positional); repeatable. |
class GitShowSettings extends GitSettings Settings for git show.
| Member | Signature | Doc |
|---|---|---|
object | object(...names: string[]): this | The objects to show (positional); repeatable. A commit, a tag, or a blob at a revision such as HEAD:deno.json — the way a build reads a file as it was, without checking anything out. |
paths | paths(...values: PathLike[]): this | Limit the output to these pathspecs (positional, after --); repeatable. |
format | format(spec: string): this | Render the commit header through a format string (--format=<fmt>). |
noPatch | noPatch(): this | Suppress the diff (--no-patch), leaving only the header. |
nameOnly | nameOnly(): this | List the changed paths instead of the diff (--name-only). |
nameStatus | nameStatus(): this | List the changed paths with their status letters (--name-status). |
stat | stat(): this | Summarise the changes (--stat). |
class GitStashSettings extends GitSettings Settings for git stash. Pick the subcommand with push, pop, apply, list, show, drop, or clear; the remaining methods apply to the one picked.
| Member | Signature | Doc |
|---|---|---|
push | push(): this | Stash the working tree and index (git stash push). |
pop | pop(): this | Restore a stash and drop it (git stash pop). |
apply | apply(): this | Restore a stash and keep it (git stash apply). |
list | list(): this | List the stashes (git stash list). |
show | show(): this | Show a stash's diff (git stash show). |
drop | drop(): this | Discard a stash (git stash drop). |
clear | clear(): this | Discard every stash (git stash clear). |
stash | stash(ref: string): this | Which stash to act on, e.g. stash@{1} (positional); defaults to the most recent. Only meaningful for pop, apply, show, and drop. |
message | message(text: string): this | Label the stash being pushed (-m). |
includeUntracked | includeUntracked(): this | Stash untracked files too (--include-untracked). |
keepIndex | keepIndex(): this | Leave what is already staged in the index (--keep-index). |
staged | staged(): this | Stash only what is staged (--staged). |
paths | paths(...values: PathLike[]): this | Stash only these pathspecs (positional, after --); repeatable. |
interface GitStatusEntry One record of git status --porcelain -z: a path and how it changed.
| Member | Signature | Doc |
|---|---|---|
index | index: string | The index (staged) status code — git's X column: M modified, A added, D deleted, R renamed, C copied, ? untracked, ! ignored, or a space when the index matches HEAD. |
workingTree | workingTree: string | The working-tree status code — git's Y column, with the same letters, or a space when the working tree matches the index. |
path | path: string | The path, relative to the repository root; for a rename, the new one. |
originalPath? | originalPath?: string | Where a renamed or copied entry came from; absent otherwise. |
class GitStatusSettings extends GitSettings Settings for git status.
| Member | Signature | Doc |
|---|---|---|
short | short(): this | Short-format output (-s/--short). |
porcelain | porcelain(): this | Stable machine-readable output (--porcelain). |
branch | branch(): this | Show branch information (-b/--branch). |
nulTerminated | nulTerminated(): this | Terminate each record with a NUL rather than a newline (-z), which also turns on --porcelain and stops git quoting unusual paths. |
untrackedFiles | untrackedFiles(mode: no | normal | all): this | How much of an untracked directory to report (--untracked-files=<mode>): no, normal (the default — the directory), or all (every file in it). |
ignored | ignored(): this | Also report ignored files (--ignored). |
paths | paths(...values: string[]): this | Limit the report to these pathspecs (positional); repeatable. |
class GitSubmoduleSettings extends GitSettings Settings for git submodule. Pick the subcommand with add, init, deinit, update, sync, status, or foreach.
| Member | Signature | Doc |
|---|---|---|
add | add(url: string, path?: PathLike): this | Add a submodule (git submodule add <url> [<path>]). |
init | init(): this | Register the submodules in .gitmodules (git submodule init). |
deinit | deinit(): this | Unregister submodules (git submodule deinit). |
update | update(): this | Check the submodules out at their recorded commits (git submodule update). |
sync | sync(): this | Copy the configured URLs into .git/config (git submodule sync). |
status | status(): this | Report each submodule's checked-out commit (git submodule status). |
foreach | foreach(...command: string[]): this | Run a command in each submodule (git submodule foreach <command>). |
paths | paths(...values: PathLike[]): this | Limit the operation to these paths (positional); repeatable. |
withInit | withInit(): this | Initialise uninitialised submodules first (--init), the flag update needs on a fresh clone. Named for the flag rather than the init subcommand, which is what init runs. |
recursive | recursive(): this | Recurse into nested submodules (--recursive). |
remote | remote(): this | Use the upstream branch's latest commit rather than the recorded one (--remote). |
force | force(): this | Discard local changes in the submodule (--force). |
depth | depth(commits: number): this | Clone the submodules shallowly (--depth <n>). |
jobs | jobs(count: number): this | Clone this many submodules in parallel (--jobs <n>). |
branch | branch(name: string): this | Track this branch when adding or updating (-b <branch>). |
class GitSwitchSettings extends GitSettings Settings for git switch.
| Member | Signature | Doc |
|---|---|---|
branch | branch(name: string): this | The branch to switch to — or, with create, the one to create. |
startPoint | startPoint(rev: string): this | The commit the new branch forks from (git's trailing <start-point>), e.g. origin/main. Without it a created branch forks from the current HEAD, which is whatever the checkout happened to be on. |
create | create(): this | Create the branch (-c); fails if it already exists. |
forceCreate | forceCreate(): this | Create the branch, resetting it if it exists (-C). |
track | track(mode: direct | inherit): this | Set up upstream tracking (--track=<mode>), direct or inherit. |
detach | detach(): this | Switch with a detached HEAD (--detach) — checking out a commit rather than a branch, which switch otherwise refuses. |
force | force(): this | Throw away local changes rather than refusing to switch (--force). |
class GitSymbolicRefSettings extends GitSettings Settings for git symbolic-ref.
| Member | Signature | Doc |
|---|---|---|
name | name(value: string): this | The symbolic ref to read or set (positional), e.g. "HEAD". |
ref | ref(value: string): this | The ref to point it at (positional), which makes this a write. |
short | short(): this | Shorten the reported ref name (--short). |
delete | delete(): this | Delete the symbolic ref (--delete). |
quietOutput | quietOutput(): this | Say nothing and exit non-zero when the ref is not symbolic (--quiet). Named apart from the inherited quiet, which silences Zuke's echo. |
reason | reason(value: string): this | The reflog reason to record for the update (-m <reason>). |
class GitTagSettings extends GitSettings Settings for git tag.
| Member | Signature | Doc |
|---|---|---|
name | name(value: string): this | The tag name. |
commit | commit(rev: string): this | The commit to tag (git's trailing <commit>), rather than HEAD. Only meaningful when creating a tag. |
message | message(text: string): this | Create an annotated tag with this message (-a -m). |
force | force(): this | Replace an existing tag (-f/--force). |
deleteTag | deleteTag(): this | Delete the tag (-d/--delete). |
list | list(pattern?: string): this | List tags (-l), optionally matching a shell pattern such as v1.*. With no pattern, lists them all. |
sort | sort(key: string): this | Order a listing (--sort=<key>), e.g. -v:refname for newest-version first — the ordering a release target wants, since the default is lexicographic and puts v1.10.0 before v1.9.0. |
const GitTasks: GitTasksApi Typed task functions for the git commands.
interface GitTasksApi The shape of GitTasks.
| Member | Signature | Doc |
|---|---|---|
init | init(configure?: Configure<GitInitSettings>): Promise<CommandOutput> | Create a repository: git init. |
clone | clone(configure?: Configure<GitCloneSettings>): Promise<CommandOutput> | Clone a repository: git clone. |
add | add(configure?: Configure<GitAddSettings>): Promise<CommandOutput> | Stage changes: git add. |
rm | rm(configure?: Configure<GitRmSettings>): Promise<CommandOutput> | Remove tracked files: git rm. |
mv | mv(configure?: Configure<GitMvSettings>): Promise<CommandOutput> | Move or rename a tracked file: git mv. |
restore | restore(configure?: Configure<GitRestoreSettings>): Promise<CommandOutput> | Restore working-tree or index contents: git restore. |
clean | clean(configure?: Configure<GitCleanSettings>): Promise<CommandOutput> | Delete untracked files: git clean. |
commit | commit(configure?: Configure<GitCommitSettings>): Promise<CommandOutput> | Record changes: git commit. |
status | status(configure?: Configure<GitStatusSettings>): Promise<CommandOutput> | Show working-tree status: git status. |
statusEntries | statusEntries(configure?: Configure<GitStatusSettings>): Promise<GitStatusEntry[]> | The working tree's changes as parsed GitStatusEntry values, from git status --porcelain -z — the form no path can corrupt. An empty array means a clean tree. The lambda configures the rest (.dir(), .untrackedFiles(), .paths()); the output format is fixed, since the parse depends on it. |
checkout | checkout(configure?: Configure<GitCheckoutSettings>): Promise<CommandOutput> | Switch branches or restore files: git checkout. |
switch | switch(configure?: Configure<GitSwitchSettings>): Promise<CommandOutput> | Switch branches: git switch, checkout's modern half. |
branch | branch(configure?: Configure<GitBranchSettings>): Promise<CommandOutput> | Manage branches: git branch. |
tag | tag(configure?: Configure<GitTagSettings>): Promise<CommandOutput> | Manage tags: git tag. |
push | push(configure?: Configure<GitPushSettings>): Promise<CommandOutput> | Update remote refs: git push. |
pull | pull(configure?: Configure<GitPullSettings>): Promise<CommandOutput> | Fetch and integrate: git pull. |
fetch | fetch(configure?: Configure<GitFetchSettings>): Promise<CommandOutput> | Download objects and refs: git fetch. |
remote | remote(configure?: Configure<GitRemoteSettings>): Promise<CommandOutput> | Manage remotes: git remote add|remove|rename|set-url|get-url|show|prune. |
remoteList | remoteList(configure?: Configure<GitRemoteSettings>): Promise<GitRemote[]> | The configured remotes as parsed GitRemote entries, each with the fetch and push URL folded together, from git remote --verbose. |
lsRemote | lsRemote(configure?: Configure<GitLsRemoteSettings>): Promise<CommandOutput> | List a remote's refs without fetching them: git ls-remote. |
log | log(configure?: Configure<GitLogSettings>): Promise<CommandOutput> | Show history: git log. |
logEntries | logEntries(configure?: Configure<GitLogSettings>): Promise<GitCommitEntry[]> | History as parsed GitCommitEntry values — SHA, parents, author, dates, subject, and body — for building a changelog or deciding what a range contains. The lambda configures the walk (.range(), .maxCount(), .paths()); the --format is fixed, since the parse depends on it. |
show | show(configure?: Configure<GitShowSettings>): Promise<CommandOutput> | Show an object: git show. |
diff | diff(configure?: Configure<GitDiffSettings>): Promise<CommandOutput> | Show changes: git diff. |
diffNames | diffNames(configure?: Configure<GitDiffSettings>): Promise<string[]> | The changed paths of a diff, from git diff --name-only -z. What a target needs to decide whether the work it guards has to run at all. |
lsFiles | lsFiles(configure?: Configure<GitLsFilesSettings>): Promise<CommandOutput> | List index and working-tree files: git ls-files. |
lsFileNames | lsFileNames(configure?: Configure<GitLsFilesSettings>): Promise<string[]> | The paths of a git ls-files -z listing — git's own file list, ignore rules already applied. |
revParse | revParse(configure?: Configure<GitRevParseSettings>): Promise<CommandOutput> | Resolve revisions and repository paths: git rev-parse. |
revision | revision(configure?: Configure<GitRevParseSettings>): Promise<string> | A git rev-parse result as a trimmed string — the commit SHA, ref name, or path a version stamp or cache key is built from. |
describe | describe(configure?: Configure<GitDescribeSettings>): Promise<CommandOutput> | Name a commit after the nearest tag: git describe. |
merge | merge(configure?: Configure<GitMergeSettings>): Promise<CommandOutput> | Join two histories: git merge. |
rebase | rebase(configure?: Configure<GitRebaseSettings>): Promise<CommandOutput> | Replay commits onto another base: git rebase. |
cherryPick | cherryPick(configure?: Configure<GitCherryPickSettings>): Promise<CommandOutput> | Apply existing commits here: git cherry-pick. |
revert | revert(configure?: Configure<GitRevertSettings>): Promise<CommandOutput> | Undo commits with new ones: git revert. |
reset | reset(configure?: Configure<GitResetSettings>): Promise<CommandOutput> | Move the branch, index, and optionally the working tree: git reset. |
stash | stash(configure?: Configure<GitStashSettings>): Promise<CommandOutput> | Park and restore uncommitted work: git stash. |
config | config(configure?: Configure<GitConfigSettings>): Promise<CommandOutput> | Read or write configuration: git config. |
configGet | configGet(configure?: Configure<GitConfigSettings>): Promise<string | undefined> | One configuration value, or undefined when the key is unset — which git config --get reports as a non-zero exit rather than as empty output. The lambda must pick the key with .get(...) or .getAll(...). |
submodule | submodule(configure?: Configure<GitSubmoduleSettings>): Promise<CommandOutput> | Manage submodules: git submodule add|init|update|sync|status|foreach. |
archive | archive(configure?: Configure<GitArchiveSettings>): Promise<CommandOutput> | Package a tree as a tarball or zip: git archive. |
apply | apply(configure?: Configure<GitApplySettings>): Promise<CommandOutput> | Apply a patch file: git apply. |
worktree | worktree(configure?: Configure<GitWorktreeSettings>): Promise<CommandOutput> | Manage worktrees: git worktree add|list|remove|prune. Pick the subcommand in the lambda — s.add(path), s.list(), s.remove(path), or s.prune(). For a listing to read rather than print, use GitTasksApi.worktreeList. |
worktreeList | worktreeList(configure?: Configure<GitWorktreeSettings>): Promise<GitWorktree[]> | List the repository's worktrees as parsed GitWorktree entries, from git worktree list --porcelain. The lambda configures the global options (.dir(), .config()); the subcommand itself is fixed, since the parse depends on it. |
defaultBranch | defaultBranch(configure?: Configure<GitDefaultBranchSettings>): Promise<string> | The name of a remote's default branch — main, master, or whatever it chose — so a build does not have to hardcode one. Reads the local refs/remotes/<remote>/HEAD first, which costs no network, and asks the remote itself when that ref was never populated. Fails when neither names a branch, rather than guessing. |
mergeBase | mergeBase(configure?: Configure<GitMergeBaseSettings>): Promise<string> | Find the common ancestor of commits: git merge-base. |
isAncestor | isAncestor(configure?: Configure<GitMergeBaseSettings>): Promise<boolean> | Whether the first commit is an ancestor of the second: git merge-base --is-ancestor, read back from its exit status. |
revList | revList(configure?: Configure<GitRevListSettings>): Promise<CommandOutput> | Walk history as a list of commits: git rev-list. |
commitCount | commitCount(configure?: Configure<GitRevListSettings>): Promise<number> | How many commits the walk holds: git rev-list --count. |
forEachRef | forEachRef(configure?: Configure<GitForEachRefSettings>): Promise<CommandOutput> | List refs with a format: git for-each-ref. |
refs | refs(configure?: Configure<GitForEachRefSettings>): Promise<GitRef[]> | The refs and what they point at, parsed: git for-each-ref. |
showRef | showRef(configure?: Configure<GitShowRefSettings>): Promise<CommandOutput> | List or verify local refs: git show-ref. |
symbolicRef | symbolicRef(configure?: Configure<GitSymbolicRefSettings>): Promise<CommandOutput> | Read or set a symbolic ref: git symbolic-ref. |
nameRev | nameRev(configure?: Configure<GitNameRevSettings>): Promise<CommandOutput> | Find symbolic names for commits: git name-rev. |
lsTree | lsTree(configure?: Configure<GitLsTreeSettings>): Promise<CommandOutput> | List the contents of a tree: git ls-tree. |
treeEntries | treeEntries(configure?: Configure<GitLsTreeSettings>): Promise<GitTreeEntry[]> | The entries of a tree, parsed: git ls-tree -z. |
catFile | catFile(configure?: Configure<GitCatFileSettings>): Promise<CommandOutput> | Read an object's contents or attributes: git cat-file. |
blobText | blobText(configure?: Configure<GitCatFileSettings>): Promise<string> | An object's contents as text, untrimmed: git cat-file -p. |
checkIgnore | checkIgnore(configure?: Configure<GitCheckIgnoreSettings>): Promise<CommandOutput> | Report which paths the ignore rules exclude: git check-ignore. |
isIgnored | isIgnored(configure?: Configure<GitCheckIgnoreSettings>): Promise<boolean> | Whether a path is excluded, read from the exit status of git check-ignore. |
blame | blame(configure?: Configure<GitBlameSettings>): Promise<CommandOutput> | Annotate a file's lines with their commits: git blame. |
blameLines | blameLines(configure?: Configure<GitBlameSettings>): Promise<GitBlameLine[]> | The annotated lines, parsed: git blame --porcelain. |
shortlog | shortlog(configure?: Configure<GitShortlogSettings>): Promise<CommandOutput> | Summarise commits by contributor: git shortlog. |
shortlogEntries | shortlogEntries(configure?: Configure<GitShortlogSettings>): Promise<GitShortlogEntry[]> | The per-contributor commit counts, parsed: git shortlog -s. |
grep | grep(configure?: Configure<GitGrepSettings>): Promise<CommandOutput> | Search tracked content: git grep. |
verifyCommit | verifyCommit(configure?: Configure<GitVerifyCommitSettings>): Promise<CommandOutput> | Check a commit's signature: git verify-commit. |
verifyTag | verifyTag(configure?: Configure<GitVerifyTagSettings>): Promise<CommandOutput> | Check a tag's signature: git verify-tag. |
isSignatureValid | isSignatureValid(configure?: Configure<GitVerifyCommitSettings>): Promise<boolean> | Whether a commit's signature is good: git verify-commit. |
isTagSignatureValid | isTagSignatureValid(configure?: Configure<GitVerifyTagSettings>): Promise<boolean> | Whether a tag's signature is good: git verify-tag. |
mergeTree | mergeTree(configure?: Configure<GitMergeTreeSettings>): Promise<CommandOutput> | Merge in memory, leaving the index and working tree alone: git merge-tree. |
mergesCleanly | mergesCleanly(configure?: Configure<GitMergeTreeSettings>): Promise<boolean> | Whether two commits merge without conflict: git merge-tree. |
run | run(configure?: Configure<GitRunSettings>): Promise<CommandOutput> | Run any other git command via .command(...). |
interface GitTreeEntry One entry of git ls-tree: an object in a tree, and how it is recorded.
| Member | Signature | Doc |
|---|---|---|
mode | mode: string | The file mode, e.g. 100644 for a regular file or 040000 for a tree. |
type | type: string | The kind of object: blob, tree, or commit for a submodule. |
objectName | objectName: string | The object name. |
path | path: string | The path, relative to the tree that was listed. |
class GitVerifyCommitSettings extends GitSettings Settings for git verify-commit.
| Member | Signature | Doc |
|---|---|---|
verbose | verbose(): this | Also print the commit's contents (-v). |
raw | raw(): this | Print gpg's raw status output (--raw). |
objects | objects(...values: string[]): this | The commits to verify (positional); repeatable. |
class GitVerifyTagSettings extends GitSettings Settings for git verify-tag.
| Member | Signature | Doc |
|---|---|---|
verbose | verbose(): this | Also print the tag's contents (-v). |
raw | raw(): this | Print gpg's raw status output (--raw). |
format | format(value: string): this | The output format (--format=<format>), in git's placeholder language. verify-tag accepts this where verify-commit does not. |
objects | objects(...values: string[]): this | The tags to verify (positional); repeatable. |
interface GitWorktree One entry of git worktree list --porcelain.
| Member | Signature | Doc |
|---|---|---|
path | path: string | The worktree's absolute path, as git reports it. |
head? | head?: string | The commit checked out there, or undefined for a bare repository. |
branch? | branch?: string | The checked-out branch, without its refs/heads/ prefix; absent when detached. |
bare | bare: boolean | Whether this entry is the bare repository rather than a working tree. |
detached | detached: boolean | Whether HEAD is detached there. |
locked | locked: boolean | Whether the worktree is locked (git worktree lock). |
class GitWorktreeSettings extends GitSettings Settings for git worktree. Pick the subcommand with add, list, remove, or prune; the remaining methods apply to the one picked, mirroring the flags git accepts for it.
| Member | Signature | Doc |
|---|---|---|
add | add(path: PathLike): this | Check a new worktree out at path (git worktree add <path>). |
list | list(): this | List the repository's worktrees (git worktree list). |
remove | remove(path: PathLike): this | Remove the worktree at path (git worktree remove <path>). |
prune | prune(): this | Discard records of worktrees whose directories are gone (git worktree prune). |
branch | branch(name: string): this | The branch to check out in the new worktree — or, with createBranch, the name of the branch to create there. |
createBranch | createBranch(): this | Create branch rather than checking out an existing one (-b). |
startPoint | startPoint(ref: string): this | The commit the new branch forks from — git's trailing <commit-ish>, e.g. origin/main. Only meaningful with createBranch: without a start point git branches from the *parent* checkout's HEAD, which is whatever the developer happened to have open. Setting this and branch without createBranch is refused: both want the same trailing position, and there is no reading of the command where git would take them both. |
detach | detach(): this | Check out with a detached HEAD (--detach). |
force | force(): this | Force the operation (--force): check out a branch already checked out elsewhere, or remove a worktree with modifications. Without it git refuses both. |
porcelain | porcelain(): this | Emit the stable machine-readable listing (--porcelain). |
const LOG_ENTRY_FORMAT: string The --format readLogEntries pins. Fields in GitCommitEntry order, separated by %x1f, each commit terminated by %x1e — separators no commit message can contain, unlike the newlines a line-oriented format would rely on.
const REF_ENTRY_FORMAT: string The --format "./git.ts".GitTasks.refs pins: the fields of one ref, separated by NUL and terminated by one, so a ref name cannot break a record.
%00 is git's own NUL placeholder, which is why the reader can rely on the separator surviving a ref name containing anything else.
type SequencerAction = continue | abort | skip | quit What to do with an operation git left in progress.