zuke.tools.git
@zuke/git 1.6.0: @zuke/git — typed git task wrappers for Zuke builds.
zuke on PyPI ↗ 56 symbols
Symbols
class GitAddSettings(GitSettings) Settings for git add.
-
paths(*values: str) -> SelfPaths/pathspecs to stage (positional); repeatable.
-
all() -> SelfStage all changes including new files (
-A/--all). -
update() -> SelfStage modifications and deletions, but not new files (
-u/--update). -
force() -> SelfStage files git would otherwise ignore (
-f/--force). -
intent_to_add() -> SelfRecord the paths' existence but not their contents (
-N/--intent-to-add), which is what makes an untracked file show up ingit diff.
class GitApplySettings(GitSettings) Settings for git apply.
-
patches(*values: str) -> SelfThe patch files to apply (positional); repeatable. Reads stdin when empty.
-
check() -> SelfReport whether the patch would apply, changing nothing (
--check). -
reverse() -> SelfApply the patch backwards (
--reverse). -
three_way() -> SelfFall back to a three-way merge when the patch does not apply cleanly (
--3way), leaving conflict markers instead of refusing outright. -
index() -> SelfApply to the index as well as the working tree (
--index). -
cached() -> SelfApply to the index only, leaving the working tree alone (
--cached). -
strip(components: float) -> SelfStrip this many leading path components (
-p<n>); git's default is 1. -
whitespace(action: Literal['nowarn', 'warn', 'fix', 'error', 'error-all']) -> SelfWhat to do about whitespace errors (
--whitespace=<action>):nowarn,warn,fix,error, orerror-all. -
exclude(*patterns: str) -> SelfSkip files matching this pattern (
--exclude=<pattern>); repeatable.
class GitArchiveSettings(GitSettings) Settings for git archive.
-
treeish(rev: str) -> SelfThe tree, commit, or tag to archive (positional, required).
-
format(name: str) -> SelfThe archive format (
--format=<fmt>), e.g.tar,tar.gz, orzip. -
output(path: str) -> SelfWrite to this file (
--output=<file>) instead of stdout. -
prefix(value: str) -> SelfPrepend this path to every entry (
--prefix=<prefix>/). -
remote(name_or_url: str) -> SelfAsk a remote repository for the archive (
--remote=<repo>). -
paths(*values: str) -> SelfArchive only these pathspecs (positional); repeatable.
class GitBlameSettings(GitSettings) Settings for git blame.
-
file(path: str) -> SelfThe file to annotate (positional).
-
porcelain() -> SelfMachine-readable output (
--porcelain). Prefer "./git.ts".GitTasks.blameLines, which parses it. -
line_porcelain() -> SelfLike porcelain, but repeating the commit header on every line (
--line-porcelain) rather than only its first appearance. -
revision(value: str) -> SelfAnnotate the file as of this revision (positional).
-
line_range(start: float, end: float | str) -> SelfAnnotate only these lines (
-L <start>,<end>); repeatable. -
show_email() -> SelfShow the author's email rather than their name (
-e). -
ignore_whitespace() -> SelfIgnore whitespace-only changes when assigning blame (
-w). -
reverse(value: str) -> SelfWalk history forward from this revision instead (
--reverse <rev>). -
ignore_revs(*revisions: str) -> SelfIgnore a revision when assigning blame (
--ignore-rev); repeatable.
class GitBranchSettings(GitSettings) Settings for git branch.
-
name(value: str) -> SelfThe branch name to create or operate on.
-
start_point(rev: str) -> SelfThe commit a created branch forks from (git's trailing
<start-point>), e.g.origin/main. -
delete_branch(force: bool | None=None) -> SelfDelete the branch (
-d, or-Dwhen forced). -
rename(new_name: str, force: bool | None=None) -> SelfRename name to
newName(-m, or-Mwhen forced). -
set_upstream_to(ref: str) -> SelfPoint the branch's upstream at this ref (
--set-upstream-to=<ref>). -
all() -> SelfList both local and remote-tracking branches (
-a/--all). -
remotes() -> SelfList remote-tracking branches only (
-r/--remotes). -
contains(rev: str) -> SelfList only branches containing this commit (
--contains <commit>). -
merged(ref: str) -> SelfList only branches already merged into this ref (
--merged <ref>) — the listing a cleanup target filters stale branches from. -
format(spec: str) -> SelfRender a listing through a format string (
--format=<fmt>), e.g.%(refname:short)for bare branch names with no*marker or padding. -
sort(key: str) -> SelfOrder a listing (
--sort=<key>), e.g.-committerdatefor most recent first.
class GitCatFileSettings(GitSettings) Settings for git cat-file.
-
object(value: str) -> SelfThe object to read (positional), e.g.
"HEAD:deno.json". -
query(kind: Literal['type', 'size', 'exists']) -> SelfReport an attribute rather than the contents:
type(-t),size(-s), orexists(-e, which answers by exit status and prints nothing). -
textconv() -> SelfRun the object through its textconv filter (
--textconv). -
filters() -> SelfRun the object through its working-tree filters (
--filters).
class GitCheckIgnoreSettings(GitSettings) Settings for git check-ignore.
-
quiet_output() -> SelfSay nothing and answer by exit status alone (
-q). Named apart from the inheritedquiet, which silences Zuke's echo of the command rather than git's output. -
verbose() -> SelfAlso report the rule that excluded each path (
-v). -
non_matching() -> SelfInclude the paths that are *not* excluded (
-n); needs verbose. -
no_index() -> SelfIgnore the index when checking (
--no-index). -
nul_terminated() -> SelfTerminate records with NUL rather than newline (
-z). -
paths(*values: str) -> SelfThe paths to check (positional); repeatable.
class GitCheckoutSettings(GitSettings) Settings for git checkout.
-
ref(target: str) -> SelfThe branch or commit to check out — or, with paths, the source to restore those paths from. Required unless paths is given.
-
paths(*paths: str) -> SelfRestore 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() -> SelfCreate a new branch (
-b). -
detach() -> SelfCheck the ref out with a detached
HEAD(--detach). -
force() -> SelfForce checkout, discarding local changes (
-f/--force).
class GitCherryPickSettings(GitReplaySettings) Settings for git cherry-pick.
-
allow_empty() -> SelfKeep a commit that produces no changes (
--allow-empty). -
ff() -> SelfFast-forward instead of rewriting when the parent matches
HEAD(--ff).
class GitCleanSettings(GitSettings) Settings for git clean.
-
paths(*values: str) -> SelfLimit the clean to these pathspecs (positional); repeatable.
-
force() -> SelfActually delete the files (
-f/--force). -
dry_run() -> SelfList what would be deleted without deleting it (
-n/--dry-run). -
directories() -> SelfAlso remove untracked directories (
-d). -
include_ignored() -> SelfRemove ignored files too (
-x) — the switch that turns a clean into a from-scratch build, sincenode_modulesandtarget/are ignored. -
only_ignored() -> SelfRemove *only* ignored files (
-X), keeping other untracked ones. -
exclude(*patterns: str) -> SelfSpare paths matching this pattern (
--exclude=<pattern>); repeatable.
class GitCloneSettings(GitSettings) Settings for git clone.
-
repository(url: str) -> SelfThe repository URL to clone (required).
-
directory(path: str) -> SelfTarget directory for the clone.
-
branch(name: str) -> SelfCheck out a specific branch (
-b/--branch). -
depth(commits: float) -> SelfCreate a shallow clone of the given depth (
--depth). -
bare() -> SelfClone a bare repository (
--bare). -
filter(spec: str) -> SelfPartial-clone filter (
--filter=<spec>), e.g.blob:nonefor a treeless clone that fetches blobs on demand — the cheap way to get full history in CI without the file contents of every revision. -
single_branch() -> SelfClone only the history of the checked-out branch (
--single-branch). -
recurse_submodules() -> SelfAlso clone submodules (
--recurse-submodules).
class GitCommitSettings(GitSettings) Settings for git commit.
-
message(text: str) -> SelfThe commit message (
-m). -
all() -> SelfStage modified/deleted files before committing (
-a/--all). -
amend() -> SelfAmend the previous commit (
--amend). -
no_edit() -> SelfKeep the existing message when amending (
--no-edit). -
allow_empty() -> SelfAllow a commit with no changes (
--allow-empty). -
no_verify() -> SelfSkip the
pre-commitandcommit-msghooks (--no-verify) — what a bot commit wants when the hooks are meant for humans at a terminal. -
author(value: str) -> SelfAttribute the commit to someone else (
--author="Name <email>"). -
paths(*values: str) -> SelfCommit only these pathspecs (positional); repeatable.
class GitConfigSettings(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.
-
get(key: str) -> SelfRead a key's value (
--get <key>). -
get_all(key: str) -> SelfRead every value of a multi-valued key (
--get-all <key>). -
set(key: str, value: str) -> SelfSet a key, replacing any existing value (
git config <key> <value>). -
add(key: str, value: str) -> SelfAdd another value to a multi-valued key (
--add <key> <value>). -
unset(key: str) -> SelfRemove a key (
--unset <key>). -
list() -> SelfList every configured key (
--list). -
global_() -> SelfUse the user's configuration (
--global). -
local() -> SelfUse the repository's configuration (
--local). -
system() -> SelfUse the machine's configuration (
--system). -
worktree() -> SelfUse the worktree's configuration (
--worktree). -
file(path: str) -> SelfUse a specific file (
--file <path>), rather than one of the scopes. -
default_value(value: str) -> SelfWhat to report when the key is unset (
--default <value>), which also makes--getexit 0 instead of 1.
class GitDefaultBranchSettings(GitSettings) Settings for "./git.ts".GitTasks.defaultBranch: which remote to ask, plus the global options every git task shares.
-
remote(name: str) -> SelfThe remote whose default branch is wanted (default
origin).
class GitDescribeSettings(GitSettings) Settings for git describe.
-
commitish(rev: str) -> SelfThe commit to describe (positional); defaults to
HEAD. -
tags() -> SelfConsider lightweight tags too, not only annotated ones (
--tags). -
all() -> SelfConsider every ref, not only tags (
--all). -
always() -> SelfFall back to an abbreviated SHA when no tag matches (
--always). -
exact_match() -> SelfFail unless the commit is exactly at a tag (
--exact-match). -
abbrev(length: float) -> SelfHow many SHA characters to append (
--abbrev=<n>).0suppresses the suffix entirely, which is how a build reads the nearest tag's bare name. -
dirty(suffix: str | None=None) -> SelfAppend a marker when the working tree is dirty (
--dirty[=<suffix>]). -
match_(*patterns: str) -> SelfOnly consider tags matching this glob (
--match <pattern>); repeatable.
class GitDiffSettings(GitSettings) Settings for git diff.
-
commits(*revs: str) -> SelfThe commits to compare (positional); repeatable. One rev diffs the working tree against it; two diff them against each other.
-
merge_base(from_: str, to: str | None=None) -> SelfCompare the two ends of a range —
from...towith three dots, which diffstoagainst 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(*values: str) -> SelfLimit the diff to these pathspecs (positional, after
--); repeatable. -
staged() -> SelfDiff the index against
HEADrather than the working tree (--staged). -
name_only() -> SelfList the changed paths instead of the patch (
--name-only). -
name_status() -> SelfList the changed paths with their status letters (
--name-status). -
stat() -> SelfSummarise the changes per file (
--stat). -
shortstat() -> SelfOne summary line for the whole diff (
--shortstat). -
unified(lines: float) -> SelfLines of context around each hunk (
--unified=<n>). -
ignore_all_space() -> SelfIgnore whitespace entirely when comparing (
--ignore-all-space). -
exit_code() -> SelfReport differences through the exit code (
--exit-code): 1 when there are any, 0 when there are none. Pair it with.noThrow()to branch onoutput.codeinstead of catching. -
diff_filter(letters: str) -> SelfKeep only files whose change matches these status letters (
--diff-filter=<letters>), e.g.ACMfor added, copied, and modified — how a lint target skips paths the diff only deleted. -
nul_terminated() -> SelfTerminate output records with a NUL rather than a newline (
-z).
class GitFetchSettings(GitSettings) Settings for git fetch.
-
remote(name: str) -> SelfThe remote to fetch from.
-
refspec(*specs: str) -> SelfAdd a refspec to fetch, after the remote —
master, ormaster:refs/remotes/origin/masterto also update the remote-tracking ref (which is what makesorigin/masterresolvable 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. -
no_tags() -> SelfSkip fetching tags (
--no-tags). -
depth(commits: float) -> SelfLimit history to this many commits (
--depth).1is enough to diff against a base branch and avoids pulling a whole history into a CI job. -
unshallow() -> SelfDeepen a shallow clone into the full history (
--unshallow) — what a release target needs beforegit describeor a changelog can see past the one commit CI checked out. -
all() -> SelfFetch from all remotes (
--all). -
tags() -> SelfAlso fetch tags (
--tags). -
prune() -> SelfPrune deleted remote refs (
--prune). -
force() -> SelfUpdate refs even when the update is not a fast-forward (
--force).
class GitForEachRefSettings(GitSettings) Settings for git for-each-ref.
-
format(value: str) -> SelfThe output format (
--format=<format>), in git's placeholder language. -
count(value: float) -> SelfShow only this many matched refs (
--count=<n>). -
sort(*keys: str) -> SelfSort by a field (
--sort=<key>), e.g."-creatordate"for newest first; repeatable, and git applies the keys in the order given. -
exclude(*patterns: str) -> SelfExclude refs matching a pattern (
--exclude=<pattern>); repeatable. -
points_at(object: str) -> SelfOnly refs pointing at this object (
--points-at=<object>). -
merged(commit: str) -> SelfOnly refs merged into this commit (
--merged=<commit>). -
no_merged(commit: str) -> SelfOnly refs not merged into this commit (
--no-merged=<commit>). -
contains(commit: str) -> SelfOnly refs whose history contains this commit (
--contains=<commit>). -
no_contains(commit: str) -> SelfOnly refs not containing this commit (
--no-contains=<commit>). -
ignore_case() -> SelfSort and filter case-insensitively (
--ignore-case). -
omit_empty() -> SelfSkip the newline after a ref that formats to nothing (
--omit-empty). -
patterns(*values: str) -> SelfThe ref patterns to match (positional), e.g.
"refs/tags/"; repeatable.
class GitGrepSettings(GitSettings) Settings for git grep.
-
pattern(*values: str) -> SelfA pattern to search for (
-e <pattern>); repeatable. -
ignore_case() -> SelfMatch case-insensitively (
-i). -
word_regexp() -> SelfMatch only at word boundaries (
-w). -
invert() -> SelfReport the lines that do *not* match (
-v). -
line_number() -> SelfPrefix each match with its line number (
-n). -
names_only() -> SelfReport only the names of matching files (
-l). -
count_matches() -> SelfReport only how many lines matched per file (
-c). -
extended_regexp() -> SelfRead the pattern as a POSIX extended regexp (
-E). -
fixed_strings() -> SelfRead the pattern as a literal string (
-F). -
cached() -> SelfSearch the index rather than the working tree (
--cached). -
untracked() -> SelfSearch untracked files as well as tracked ones (
--untracked). -
nul_terminated() -> SelfTerminate output records with NUL (
-z). -
max_depth(value: float) -> SelfDescend at most this many directories (
--max-depth=<n>). -
context(lines: float) -> SelfShow this many lines of context around each match (
-C <n>). -
revisions(*values: str) -> SelfSearch these revisions rather than the working tree (positional).
-
paths(*values: str) -> SelfLimit the search to these paths (positional); repeatable.
class GitInitSettings(GitSettings) Settings for git init.
-
bare() -> SelfCreate a bare repository (
--bare). -
initial_branch(name: str) -> SelfName the initial branch (
-b/--initial-branch).
class GitLogSettings(GitSettings) Settings for git log.
-
revisions(*revs: str) -> SelfRevisions to walk (positional), e.g.
HEADororigin/main; repeatable. -
range(from_: str, to: str | None=None) -> SelfWalk the commits in
from..to— what is ontoand not onfrom, the range a changelog since the last tag is built from.todefaults toHEAD. -
paths(*values: str) -> SelfLimit the walk to these pathspecs (positional, after
--); repeatable. -
max_count(count: float) -> SelfStop after this many commits (
--max-count=<n>). -
skip(count: float) -> SelfSkip this many commits before reporting any (
--skip=<n>). -
oneline() -> SelfOne abbreviated line per commit (
--oneline). -
format(spec: str) -> SelfRender each commit through a format string (
--format=<fmt>), e.g.%H %s. Given after oneline, so it wins when both are set. -
since(date: str) -> SelfOnly commits more recent than this date (
--since=<date>). -
until(date: str) -> SelfOnly commits older than this date (
--until=<date>). -
author(*patterns: str) -> SelfOnly commits whose author matches this pattern (
--author=); repeatable. -
grep(*patterns: str) -> SelfOnly commits whose message matches this pattern (
--grep=); repeatable. -
no_merges() -> SelfSkip merge commits (
--no-merges). -
first_parent() -> SelfFollow only the first parent of a merge (
--first-parent). -
reverse() -> SelfReport oldest first (
--reverse). -
follow() -> SelfKeep following a single file across renames (
--follow).
class GitLsFilesSettings(GitSettings) Settings for git ls-files.
-
paths(*values: str) -> SelfLimit the listing to these pathspecs (positional); repeatable.
-
cached() -> SelfList files in the index (
--cached), git's default. -
modified() -> SelfList files modified in the working tree (
--modified). -
deleted() -> SelfList files deleted from the working tree (
--deleted). -
others() -> SelfList untracked files (
--others). Pair it with excludeStandard, or the listing includes everything.gitignorecovers. -
ignored() -> SelfList ignored files (
--ignored); only meaningful with others. -
stage() -> SelfShow the mode, object name, and stage of each entry (
--stage). -
exclude_standard() -> SelfApply the standard ignore rules (
--exclude-standard). -
directory() -> SelfReport an untracked directory once rather than every file in it (
--directory). -
error_unmatch() -> SelfExit 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. -
nul_terminated() -> SelfTerminate each entry with a NUL rather than a newline (
-z).
class GitLsRemoteSettings(GitSettings) Settings for git ls-remote.
-
remote(name_or_url: str) -> SelfThe remote (or URL) to ask; defaults to the branch's upstream.
-
patterns(*values: str) -> SelfLimit the listing to refs matching these patterns (positional); repeatable.
-
heads() -> SelfList branch refs only (
--heads). -
tags() -> SelfList tag refs only (
--tags). -
refs() -> SelfHide peeled tags and pseudo-refs (
--refs). -
symref() -> SelfAlso report what the remote's
HEADpoints at (--symref). -
exit_code() -> SelfExit 2 when nothing matched (
--exit-code).
class GitLsTreeSettings(GitSettings) Settings for git ls-tree.
-
tree(value: str) -> SelfThe tree-ish to list (positional), e.g.
"HEAD"or"v1.0.0". -
recursive() -> SelfRecurse into subtrees (
-r). -
trees_only() -> SelfShow only trees, not blobs (
-d). -
show_trees() -> SelfShow the trees themselves while recursing (
-t). -
nul_terminated() -> SelfTerminate entries with NUL rather than newline (
-z). -
long() -> SelfInclude each object's size (
--long). -
name_only() -> SelfList only the file names (
--name-only). -
object_only() -> SelfList only the object names (
--object-only). -
full_name() -> SelfReport paths from the repository root (
--full-name). -
full_tree() -> SelfList the whole tree, not just the current directory (
--full-tree). -
abbrev(digits: float) -> SelfAbbreviate object names to this many digits (
--abbrev=<n>). -
paths(*values: str) -> SelfLimit the listing to these paths (positional); repeatable.
class GitMergeBaseSettings(GitSettings) Settings for git merge-base.
-
all() -> SelfOutput every common ancestor rather than one (
--all). -
octopus() -> SelfFind the ancestors for a single n-way merge (
--octopus). -
independent() -> SelfList the revisions not reachable from any other (
--independent). -
is_ancestor() -> SelfAsk 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. -
fork_point() -> SelfFind where a commit forked from a ref's reflog (
--fork-point). -
commits(*values: str) -> SelfThe commits to consider (positional); repeatable.
class GitMergeSettings(GitSequencerSettings) Settings for git merge.
-
refs(*values: str) -> SelfThe commits to merge into the current branch (positional); repeatable.
-
message(text: str) -> SelfThe merge commit's message (
-m). -
no_ff() -> SelfAlways create a merge commit (
--no-ff), even when a fast-forward would do. -
ff_only() -> SelfRefuse anything but a fast-forward (
--ff-only). -
squash() -> SelfStage the merged result without recording a merge (
--squash). -
no_commit() -> SelfMerge but leave the commit to the caller (
--no-commit). -
strategy(name: str) -> SelfThe merge strategy (
--strategy=<name>), e.g.ours. -
strategy_option(*options: str) -> SelfAn option for the strategy (
--strategy-option=<option>), e.g.theirsto resolve conflicting hunks in favour of the merged branch; repeatable. -
allow_unrelated_histories() -> SelfMerge histories that share no commit (
--allow-unrelated-histories).
class GitMergeTreeSettings(GitSettings) Settings for git merge-tree.
-
write_tree() -> SelfDo 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() -> SelfAlso print the informational and conflict messages (
--messages). -
name_only() -> SelfList conflicted filenames without modes or object names (
--name-only). -
nul_terminated() -> SelfSeparate paths with NUL rather than newline (
-z). -
allow_unrelated_histories() -> SelfPermit merging histories with no common ancestor (
--allow-unrelated-histories). -
merge_base(commit: str) -> SelfUse this commit as the merge base (
--merge-base=<commit>). -
branches(*values: str) -> SelfThe two branches to merge (positional).
class GitMvSettings(GitSettings) Settings for git mv.
-
sources(*values: str) -> SelfThe path(s) to move (positional, required); repeatable.
-
destination(path: str) -> SelfWhere they move to (required): a file name for a single source, a directory when there is more than one.
-
force() -> SelfOverwrite an existing destination (
-f/--force). -
dry_run() -> SelfReport what would move without moving it (
-n/--dry-run).
class GitNameRevSettings(GitSettings) Settings for git name-rev.
-
tags() -> SelfUse only tags to name the commits (
--tags). -
all() -> SelfName every reachable commit (
--all). -
name_only() -> SelfPrint only the name, not the commit it names (
--name-only). -
always_name() -> SelfFall back to the object name when nothing else names it (
--always). -
refs(*patterns: str) -> SelfOnly consider refs matching these patterns (
--refs=<pattern>). -
commits(*values: str) -> SelfThe commits to name (positional); repeatable.
class GitPullSettings(GitSettings) Settings for git pull.
-
remote(name: str) -> SelfThe remote to pull from.
-
ref(value: str) -> SelfThe refspec/branch to pull.
-
rebase() -> SelfRebase instead of merge (
--rebase). -
no_rebase() -> SelfMerge rather than rebase (
--no-rebase), whateverpull.rebaseis set to in the ambient config — the flag a build reaches for when it must not depend on the machine it runs on. -
ff_only() -> SelfOnly fast-forward (
--ff-only). -
depth(commits: float) -> SelfLimit the fetched history to this many commits (
--depth). -
tags() -> SelfAlso fetch tags (
--tags). -
prune() -> SelfPrune deleted remote refs while fetching (
--prune).
class GitPushSettings(GitSettings) Settings for git push.
-
remote(name: str) -> SelfThe remote to push to (e.g.
origin). -
ref(value: str) -> SelfThe refspec/branch to push.
-
set_upstream() -> SelfSet the upstream tracking ref (
-u/--set-upstream). -
tags() -> SelfAlso push tags (
--tags). -
follow_tags() -> SelfPush 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. -
force_with_lease() -> SelfForce push, but only if the remote ref is unchanged (
--force-with-lease). -
delete_ref() -> SelfDelete the remote ref (
--delete). -
atomic() -> SelfUpdate every ref or none (
--atomic). -
dry_run() -> SelfReport what would be pushed without pushing it (
--dry-run). -
push_option(*values: str) -> SelfSend a server-side option (
--push-option=<value>); repeatable. GitLab reads these forci.skipand merge-request creation.
class GitRebaseSettings(GitSequencerSettings) Settings for git rebase.
-
upstream(rev: str) -> SelfThe commit the current branch is replayed onto (positional).
-
branch(name: str) -> SelfRebase this branch rather than the checked-out one (git's
<branch>). -
onto(rev: str) -> SelfReplay onto a different base than the upstream (
--onto <newbase>). -
autosquash() -> SelfFold
fixup!/squash!commits into their targets (--autosquash). -
autostash() -> SelfStash local changes and restore them afterwards (
--autostash), instead of refusing to start on a dirty tree. -
keep_empty() -> SelfKeep commits that produce no changes (
--keep-empty). -
rebase_merges() -> SelfRecreate merge commits rather than flattening them (
--rebase-merges). -
strategy(name: str) -> SelfThe merge strategy used to replay each commit (
--strategy=<name>). -
strategy_option(*options: str) -> SelfAn option for that strategy (
--strategy-option=<option>); repeatable. -
skip() -> SelfDrop the current commit and carry on (
--skip).
class GitRemoteSettings(GitSettings) Settings for git remote. Pick the subcommand with list, add, remove, rename, setUrl, getUrl, show, or prune.
-
list() -> SelfList the configured remotes (
git remote), the default. -
add(name: str, url: str) -> SelfAdd a remote (
git remote add <name> <url>). -
remove(name: str) -> SelfRemove a remote and its tracking refs (
git remote remove <name>). -
rename(old_name: str, new_name: str) -> SelfRename a remote (
git remote rename <old> <new>). -
set_url(name: str, url: str) -> SelfChange a remote's URL (
git remote set-url <name> <url>). Add pushUrl to change only the push URL. -
get_url(name: str) -> SelfPrint a remote's URL (
git remote get-url <name>). -
show(name: str) -> SelfDescribe a remote and its branches (
git remote show <name>). -
prune(name: str) -> SelfDelete tracking refs the remote no longer has (
git remote prune <name>). -
verbose() -> SelfShow each remote's URLs when listing (
-v/--verbose). -
fetch() -> SelfFetch from the remote right after adding it (
-f,addonly). -
track(branch: str) -> SelfTrack only this branch (
-t <branch>,addonly). -
push_url() -> SelfOperate on the push URL (
--push), for setUrl and getUrl.
class GitReplaySettings(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.
-
commits(*revs: str) -> SelfThe commits to replay (positional, required); repeatable.
-
no_commit() -> SelfApply the change without committing it (
-n/--no-commit). -
mainline(parent: float) -> SelfWhich 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() -> SelfAdd a
Signed-off-bytrailer (--signoff). -
skip() -> SelfDrop the current commit and carry on (
--skip).
class GitResetSettings(GitSettings) Settings for git reset.
-
ref(rev: str) -> SelfThe commit to reset to (positional); defaults to
HEAD. -
paths(*values: str) -> SelfReset only these pathspecs — unstaging them (positional); repeatable.
-
soft() -> SelfMove the branch only, keeping the index and working tree (
--soft). -
mixed() -> SelfReset the index but not the working tree (
--mixed), git's default. -
hard() -> SelfReset the index *and* the working tree (
--hard), discarding changes. -
merge() -> SelfReset, keeping changes to files that differ between the commits (
--merge). -
keep() -> SelfLike merge, but refuse when a changed file differs (
--keep).
class GitRestoreSettings(GitSettings) Settings for git restore.
-
paths(*values: str) -> SelfThe pathspecs to restore (positional, required); repeatable.
-
source(treeish: str) -> SelfRestore the contents from this commit or tree (
--source=<tree-ish>) rather than from the index. -
staged() -> SelfRestore the index (
--staged) — unstaging the paths. Combine with worktree to reset both, which is whatgit restore -SWdoes. -
worktree() -> SelfRestore the working tree (
--worktree), git's default when neither is given.
class GitRevertSettings(GitReplaySettings) Settings for git revert.
-
no_edit() -> SelfTake the generated message without opening an editor (
--no-edit).
class GitRevListSettings(GitSettings) Settings for git rev-list.
-
count() -> SelfPrint how many commits the walk found rather than listing them (
--count). Prefer "./git.ts".GitTasks.commitCount, which reads that number back. -
max_count(value: float) -> SelfStop after this many commits (
--max-count=<n>). -
skip(value: float) -> SelfSkip this many commits before printing (
--skip=<n>). -
all() -> SelfWalk every ref in
refs/(--all). -
branches() -> SelfWalk every branch (
--branches). -
tags() -> SelfWalk every tag (
--tags). -
remotes() -> SelfWalk every remote-tracking branch (
--remotes). -
no_merges() -> SelfOmit merge commits (
--no-merges). -
merges() -> SelfKeep only merge commits (
--merges). -
first_parent() -> SelfFollow only the first parent of each merge (
--first-parent). -
reverse() -> SelfEmit the commits oldest first (
--reverse). -
topo_order() -> SelfOrder by topology rather than date (
--topo-order). -
date_order() -> SelfOrder by commit date (
--date-order). -
since(value: str) -> SelfOnly commits after this date (
--since=<date>). -
until(value: str) -> SelfOnly commits before this date (
--until=<date>). -
author(pattern: str) -> SelfOnly commits whose author matches (
--author=<pattern>). -
commits(*values: str) -> SelfThe commits or ranges to walk (positional), e.g.
"HEAD"or"origin/main..HEAD"; repeatable. -
paths(*values: str) -> SelfLimit the walk to commits touching these paths (positional); repeatable.
class GitRevParseSettings(GitSettings) Settings for git rev-parse.
-
rev(*values: str) -> SelfThe revisions or arguments to resolve (positional); repeatable.
-
short(length: float | None=None) -> SelfAbbreviate the SHA (
--short, or--short=<n>with a length). git picks a length long enough to stay unambiguous when none is given. -
abbrev_ref() -> SelfPrint the ref's short name (
--abbrev-ref), e.g.mainforHEAD. -
verify() -> SelfFail rather than echo the argument when it names no object (
--verify). -
git_dir() -> SelfPrint the path of the
.gitdirectory (--git-dir). -
show_toplevel() -> SelfPrint the absolute path of the working tree's root (
--show-toplevel). -
show_prefix() -> SelfPrint the current directory's path relative to that root (
--show-prefix). -
is_inside_work_tree() -> SelfPrint whether this is inside a working tree (
--is-inside-work-tree).
class GitRmSettings(GitSettings) Settings for git rm.
-
paths(*values: str) -> SelfPaths/pathspecs to remove (positional, required); repeatable.
-
cached() -> SelfRemove from the index only, leaving the file on disk (
--cached) — how a file committed by mistake stops being tracked without being deleted. -
recursive() -> SelfRecurse into directories (
-r). -
force() -> SelfRemove even when the file has staged or local changes (
-f/--force). -
dry_run() -> SelfReport what would be removed without removing it (
-n/--dry-run). -
ignore_unmatch() -> SelfExit 0 when no path matches (
--ignore-unmatch).
class GitRunSettings(GitSettings) Settings for an arbitrary git command not covered by a typed task.
-
command(*parts: str | float) -> SelfThe subcommand and its arguments, e.g.
command("bisect", "start").
class GitSequencerSettings(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.
-
continue_() -> SelfResume the operation once the conflict is resolved (
--continue). -
abort() -> SelfUndo it and restore the pre-operation state (
--abort). -
quit() -> SelfForget the operation, leaving the tree as it is (
--quit).
class GitSettings(ToolSettings) Shared base for every git subcommand: the binary and global options.
-
dir(path: str) -> SelfRun git as if started in
path(-C <path>). -
config(key: str, value: str) -> SelfSet a one-off config value (
-c key=value); repeatable.
class GitShortlogSettings(GitSettings) Settings for git shortlog.
-
summary() -> SelfReport only the commit count per author, without the subjects (
-s). Prefer "./git.ts".GitTasks.shortlogEntries, which reads that output back. -
numbered() -> SelfSort by commit count rather than by name (
-n). -
email() -> SelfInclude each author's email address (
-e). -
committer() -> SelfGroup by committer rather than author (
-c). -
group(*fields: str) -> SelfGroup by a named field (
--group=<field>), e.g."trailer:co-authored-by". -
commits(*values: str) -> SelfThe revision range to summarise (positional); repeatable.
-
paths(*values: str) -> SelfLimit the summary to commits touching these paths (positional).
class GitShowRefSettings(GitSettings) Settings for git show-ref.
-
tags() -> SelfOnly tags (
--tags); may be combined with heads. -
heads() -> SelfOnly branch heads (
--heads); may be combined with tags. -
head() -> SelfInclude
HEADeven when a filter would exclude it (--head). -
dereference() -> SelfDereference tags into the objects they point at (
--dereference). -
hash() -> SelfPrint only the object name, without the ref (
--hash). -
verify() -> SelfRequire an exact ref path and fail otherwise (
--verify). -
exists() -> SelfCheck a ref exists without resolving it (
--exists). -
quiet_output() -> SelfSuppress git's own stdout (
--quiet), leaving the exit status as the answer — the useful pairing with verify. Named apart from the inheritedquiet, which silences Zuke's echo of the command rather than git's output. -
abbrev(digits: float) -> SelfAbbreviate object names to this many digits (
--abbrev=<n>). -
patterns(*values: str) -> SelfThe ref patterns to show (positional); repeatable.
class GitShowSettings(GitSettings) Settings for git show.
-
object(*names: str) -> SelfThe 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(*values: str) -> SelfLimit the output to these pathspecs (positional, after
--); repeatable. -
format(spec: str) -> SelfRender the commit header through a format string (
--format=<fmt>). -
no_patch() -> SelfSuppress the diff (
--no-patch), leaving only the header. -
name_only() -> SelfList the changed paths instead of the diff (
--name-only). -
name_status() -> SelfList the changed paths with their status letters (
--name-status). -
stat() -> SelfSummarise the changes (
--stat).
class GitStashSettings(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.
-
push() -> SelfStash the working tree and index (
git stash push). -
pop() -> SelfRestore a stash and drop it (
git stash pop). -
apply() -> SelfRestore a stash and keep it (
git stash apply). -
list() -> SelfList the stashes (
git stash list). -
show() -> SelfShow a stash's diff (
git stash show). -
drop() -> SelfDiscard a stash (
git stash drop). -
clear() -> SelfDiscard every stash (
git stash clear). -
stash(ref: str) -> SelfWhich stash to act on, e.g.
stash@{1}(positional); defaults to the most recent. Only meaningful for pop, apply, show, and drop. -
message(text: str) -> SelfLabel the stash being pushed (
-m). -
include_untracked() -> SelfStash untracked files too (
--include-untracked). -
keep_index() -> SelfLeave what is already staged in the index (
--keep-index). -
staged() -> SelfStash only what is staged (
--staged). -
paths(*values: str) -> SelfStash only these pathspecs (positional, after
--); repeatable.
class GitStatusSettings(GitSettings) Settings for git status.
-
short() -> SelfShort-format output (
-s/--short). -
porcelain() -> SelfStable machine-readable output (
--porcelain). -
branch() -> SelfShow branch information (
-b/--branch). -
nul_terminated() -> SelfTerminate each record with a NUL rather than a newline (
-z), which also turns on--porcelainand stops git quoting unusual paths. -
untracked_files(mode: Literal['no', 'normal', 'all']) -> SelfHow much of an untracked directory to report (
--untracked-files=<mode>):no,normal(the default — the directory), orall(every file in it). -
ignored() -> SelfAlso report ignored files (
--ignored). -
paths(*values: str) -> SelfLimit the report to these pathspecs (positional); repeatable.
class GitSubmoduleSettings(GitSettings) Settings for git submodule. Pick the subcommand with add, init, deinit, update, sync, status, or foreach.
-
add(url: str, path: str | None=None) -> SelfAdd a submodule (
git submodule add <url> [<path>]). -
init() -> SelfRegister the submodules in
.gitmodules(git submodule init). -
deinit() -> SelfUnregister submodules (
git submodule deinit). -
update() -> SelfCheck the submodules out at their recorded commits (
git submodule update). -
sync() -> SelfCopy the configured URLs into
.git/config(git submodule sync). -
status() -> SelfReport each submodule's checked-out commit (
git submodule status). -
foreach(*command: str) -> SelfRun a command in each submodule (
git submodule foreach <command>). -
paths(*values: str) -> SelfLimit the operation to these paths (positional); repeatable.
-
with_init() -> SelfInitialise uninitialised submodules first (
--init), the flag update needs on a fresh clone. Named for the flag rather than theinitsubcommand, which is what init runs. -
recursive() -> SelfRecurse into nested submodules (
--recursive). -
remote() -> SelfUse the upstream branch's latest commit rather than the recorded one (
--remote). -
force() -> SelfDiscard local changes in the submodule (
--force). -
depth(commits: float) -> SelfClone the submodules shallowly (
--depth <n>). -
jobs(count: float) -> SelfClone this many submodules in parallel (
--jobs <n>). -
branch(name: str) -> SelfTrack this branch when adding or updating (
-b <branch>).
class GitSwitchSettings(GitSettings) Settings for git switch.
-
branch(name: str) -> SelfThe branch to switch to — or, with create, the one to create.
-
start_point(rev: str) -> SelfThe commit the new branch forks from (git's trailing
<start-point>), e.g.origin/main. Without it a created branch forks from the currentHEAD, which is whatever the checkout happened to be on. -
create() -> SelfCreate the branch (
-c); fails if it already exists. -
force_create() -> SelfCreate the branch, resetting it if it exists (
-C). -
track(mode: Literal['direct', 'inherit']) -> SelfSet up upstream tracking (
--track=<mode>),directorinherit. -
detach() -> SelfSwitch with a detached
HEAD(--detach) — checking out a commit rather than a branch, whichswitchotherwise refuses. -
force() -> SelfThrow away local changes rather than refusing to switch (
--force).
class GitSymbolicRefSettings(GitSettings) Settings for git symbolic-ref.
-
name(value: str) -> SelfThe symbolic ref to read or set (positional), e.g.
"HEAD". -
ref(value: str) -> SelfThe ref to point it at (positional), which makes this a write.
-
short() -> SelfShorten the reported ref name (
--short). -
delete() -> SelfDelete the symbolic ref (
--delete). -
quiet_output() -> SelfSay nothing and exit non-zero when the ref is not symbolic (
--quiet). Named apart from the inheritedquiet, which silences Zuke's echo. -
reason(value: str) -> SelfThe reflog reason to record for the update (
-m <reason>).
class GitTagSettings(GitSettings) Settings for git tag.
-
name(value: str) -> SelfThe tag name.
-
commit(rev: str) -> SelfThe commit to tag (git's trailing
<commit>), rather thanHEAD. Only meaningful when creating a tag. -
message(text: str) -> SelfCreate an annotated tag with this message (
-a -m). -
force() -> SelfReplace an existing tag (
-f/--force). -
delete_tag() -> SelfDelete the tag (
-d/--delete). -
list(pattern: str | None=None) -> SelfList tags (
-l), optionally matching a shell pattern such asv1.*. With no pattern, lists them all. -
sort(key: str) -> SelfOrder a listing (
--sort=<key>), e.g.-v:refnamefor newest-version first — the ordering a release target wants, since the default is lexicographic and putsv1.10.0beforev1.9.0.
class GitTasks Typed task functions for the git commands.
-
static async init(ctx: ServiceContext, configure: Callable[[GitInitSettings], GitInitSettings] | None=None) -> ExecResultCreate a repository:
git init. -
static async clone(ctx: ServiceContext, configure: Callable[[GitCloneSettings], GitCloneSettings] | None=None) -> ExecResultClone a repository:
git clone. -
static async add(ctx: ServiceContext, configure: Callable[[GitAddSettings], GitAddSettings] | None=None) -> ExecResultStage changes:
git add. -
static async rm(ctx: ServiceContext, configure: Callable[[GitRmSettings], GitRmSettings] | None=None) -> ExecResultRemove tracked files:
git rm. -
static async mv(ctx: ServiceContext, configure: Callable[[GitMvSettings], GitMvSettings] | None=None) -> ExecResultMove or rename a tracked file:
git mv. -
static async restore(ctx: ServiceContext, configure: Callable[[GitRestoreSettings], GitRestoreSettings] | None=None) -> ExecResultRestore working-tree or index contents:
git restore. -
static async clean(ctx: ServiceContext, configure: Callable[[GitCleanSettings], GitCleanSettings] | None=None) -> ExecResultDelete untracked files:
git clean. -
static async commit(ctx: ServiceContext, configure: Callable[[GitCommitSettings], GitCommitSettings] | None=None) -> ExecResultRecord changes:
git commit. -
static async status(ctx: ServiceContext, configure: Callable[[GitStatusSettings], GitStatusSettings] | None=None) -> ExecResultShow working-tree status:
git status. -
static async status_entries(ctx: ServiceContext, configure: Callable[[GitStatusSettings], GitStatusSettings] | None=None) -> objectThe 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. -
static async checkout(ctx: ServiceContext, configure: Callable[[GitCheckoutSettings], GitCheckoutSettings] | None=None) -> ExecResultSwitch branches or restore files:
git checkout. -
static async switch(ctx: ServiceContext, configure: Callable[[GitSwitchSettings], GitSwitchSettings] | None=None) -> ExecResultSwitch branches:
git switch,checkout's modern half. -
static async branch(ctx: ServiceContext, configure: Callable[[GitBranchSettings], GitBranchSettings] | None=None) -> ExecResultManage branches:
git branch. -
static async tag(ctx: ServiceContext, configure: Callable[[GitTagSettings], GitTagSettings] | None=None) -> ExecResultManage tags:
git tag. -
static async push(ctx: ServiceContext, configure: Callable[[GitPushSettings], GitPushSettings] | None=None) -> ExecResultUpdate remote refs:
git push. -
static async pull(ctx: ServiceContext, configure: Callable[[GitPullSettings], GitPullSettings] | None=None) -> ExecResultFetch and integrate:
git pull. -
static async fetch(ctx: ServiceContext, configure: Callable[[GitFetchSettings], GitFetchSettings] | None=None) -> ExecResultDownload objects and refs:
git fetch. -
static async remote(ctx: ServiceContext, configure: Callable[[GitRemoteSettings], GitRemoteSettings] | None=None) -> ExecResultManage remotes:
git remote add|remove|rename|set-url|get-url|show|prune. -
static async remote_list(ctx: ServiceContext, configure: Callable[[GitRemoteSettings], GitRemoteSettings] | None=None) -> objectThe configured remotes as parsed GitRemote entries, each with the fetch and push URL folded together, from
git remote --verbose. -
static async ls_remote(ctx: ServiceContext, configure: Callable[[GitLsRemoteSettings], GitLsRemoteSettings] | None=None) -> ExecResultList a remote's refs without fetching them:
git ls-remote. -
static async log(ctx: ServiceContext, configure: Callable[[GitLogSettings], GitLogSettings] | None=None) -> ExecResultShow history:
git log. -
static async log_entries(ctx: ServiceContext, configure: Callable[[GitLogSettings], GitLogSettings] | None=None) -> objectHistory 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--formatis fixed, since the parse depends on it. -
static async show(ctx: ServiceContext, configure: Callable[[GitShowSettings], GitShowSettings] | None=None) -> ExecResultShow an object:
git show. -
static async diff(ctx: ServiceContext, configure: Callable[[GitDiffSettings], GitDiffSettings] | None=None) -> ExecResultShow changes:
git diff. -
static async diff_names(ctx: ServiceContext, configure: Callable[[GitDiffSettings], GitDiffSettings] | None=None) -> objectThe 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. -
static async ls_files(ctx: ServiceContext, configure: Callable[[GitLsFilesSettings], GitLsFilesSettings] | None=None) -> ExecResultList index and working-tree files:
git ls-files. -
static async ls_file_names(ctx: ServiceContext, configure: Callable[[GitLsFilesSettings], GitLsFilesSettings] | None=None) -> objectThe paths of a
git ls-files -zlisting — git's own file list, ignore rules already applied. -
static async rev_parse(ctx: ServiceContext, configure: Callable[[GitRevParseSettings], GitRevParseSettings] | None=None) -> ExecResultResolve revisions and repository paths:
git rev-parse. -
static async revision(ctx: ServiceContext, configure: Callable[[GitRevParseSettings], GitRevParseSettings] | None=None) -> objectA
git rev-parseresult as a trimmed string — the commit SHA, ref name, or path a version stamp or cache key is built from. -
static async describe(ctx: ServiceContext, configure: Callable[[GitDescribeSettings], GitDescribeSettings] | None=None) -> ExecResultName a commit after the nearest tag:
git describe. -
static async merge(ctx: ServiceContext, configure: Callable[[GitMergeSettings], GitMergeSettings] | None=None) -> ExecResultJoin two histories:
git merge. -
static async rebase(ctx: ServiceContext, configure: Callable[[GitRebaseSettings], GitRebaseSettings] | None=None) -> ExecResultReplay commits onto another base:
git rebase. -
static async cherry_pick(ctx: ServiceContext, configure: Callable[[GitCherryPickSettings], GitCherryPickSettings] | None=None) -> ExecResultApply existing commits here:
git cherry-pick. -
static async revert(ctx: ServiceContext, configure: Callable[[GitRevertSettings], GitRevertSettings] | None=None) -> ExecResultUndo commits with new ones:
git revert. -
static async reset(ctx: ServiceContext, configure: Callable[[GitResetSettings], GitResetSettings] | None=None) -> ExecResultMove the branch, index, and optionally the working tree:
git reset. -
static async stash(ctx: ServiceContext, configure: Callable[[GitStashSettings], GitStashSettings] | None=None) -> ExecResultPark and restore uncommitted work:
git stash. -
static async config(ctx: ServiceContext, configure: Callable[[GitConfigSettings], GitConfigSettings] | None=None) -> ExecResultRead or write configuration:
git config. -
static async config_get(ctx: ServiceContext, configure: Callable[[GitConfigSettings], GitConfigSettings] | None=None) -> objectOne configuration value, or
undefinedwhen the key is unset — whichgit config --getreports as a non-zero exit rather than as empty output. The lambda must pick the key with.get(...)or.getAll(...). -
static async submodule(ctx: ServiceContext, configure: Callable[[GitSubmoduleSettings], GitSubmoduleSettings] | None=None) -> ExecResultManage submodules:
git submodule add|init|update|sync|status|foreach. -
static async archive(ctx: ServiceContext, configure: Callable[[GitArchiveSettings], GitArchiveSettings] | None=None) -> ExecResultPackage a tree as a tarball or zip:
git archive. -
static async apply(ctx: ServiceContext, configure: Callable[[GitApplySettings], GitApplySettings] | None=None) -> ExecResultApply a patch file:
git apply. -
static async worktree(ctx: ServiceContext, configure: Callable[[GitWorktreeSettings], GitWorktreeSettings] | None=None) -> ExecResultManage worktrees:
git worktree add|list|remove|prune. Pick the subcommand in the lambda —s.add(path),s.list(),s.remove(path), ors.prune(). For a listing to read rather than print, use GitTasksApi.worktreeList. -
static async worktree_list(ctx: ServiceContext, configure: Callable[[GitWorktreeSettings], GitWorktreeSettings] | None=None) -> objectList 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. -
static async default_branch(ctx: ServiceContext, configure: Callable[[GitDefaultBranchSettings], GitDefaultBranchSettings] | None=None) -> objectThe name of a remote's default branch —
main,master, or whatever it chose — so a build does not have to hardcode one. Reads the localrefs/remotes/<remote>/HEADfirst, which costs no network, and asks the remote itself when that ref was never populated. Fails when neither names a branch, rather than guessing. -
static async merge_base(ctx: ServiceContext, configure: Callable[[GitMergeBaseSettings], GitMergeBaseSettings] | None=None) -> objectFind the common ancestor of commits:
git merge-base. -
static async is_ancestor(ctx: ServiceContext, configure: Callable[[GitMergeBaseSettings], GitMergeBaseSettings] | None=None) -> objectWhether the first commit is an ancestor of the second:
git merge-base --is-ancestor, read back from its exit status. -
static async rev_list(ctx: ServiceContext, configure: Callable[[GitRevListSettings], GitRevListSettings] | None=None) -> ExecResultWalk history as a list of commits:
git rev-list. -
static async commit_count(ctx: ServiceContext, configure: Callable[[GitRevListSettings], GitRevListSettings] | None=None) -> objectHow many commits the walk holds:
git rev-list --count. -
static async for_each_ref(ctx: ServiceContext, configure: Callable[[GitForEachRefSettings], GitForEachRefSettings] | None=None) -> ExecResultList refs with a format:
git for-each-ref. -
static async refs(ctx: ServiceContext, configure: Callable[[GitForEachRefSettings], GitForEachRefSettings] | None=None) -> objectThe refs and what they point at, parsed:
git for-each-ref. -
static async show_ref(ctx: ServiceContext, configure: Callable[[GitShowRefSettings], GitShowRefSettings] | None=None) -> ExecResultList or verify local refs:
git show-ref. -
static async symbolic_ref(ctx: ServiceContext, configure: Callable[[GitSymbolicRefSettings], GitSymbolicRefSettings] | None=None) -> ExecResultRead or set a symbolic ref:
git symbolic-ref. -
static async name_rev(ctx: ServiceContext, configure: Callable[[GitNameRevSettings], GitNameRevSettings] | None=None) -> ExecResultFind symbolic names for commits:
git name-rev. -
static async ls_tree(ctx: ServiceContext, configure: Callable[[GitLsTreeSettings], GitLsTreeSettings] | None=None) -> ExecResultList the contents of a tree:
git ls-tree. -
static async tree_entries(ctx: ServiceContext, configure: Callable[[GitLsTreeSettings], GitLsTreeSettings] | None=None) -> objectThe entries of a tree, parsed:
git ls-tree -z. -
static async cat_file(ctx: ServiceContext, configure: Callable[[GitCatFileSettings], GitCatFileSettings] | None=None) -> ExecResultRead an object's contents or attributes:
git cat-file. -
static async blob_text(ctx: ServiceContext, configure: Callable[[GitCatFileSettings], GitCatFileSettings] | None=None) -> objectAn object's contents as text, untrimmed:
git cat-file -p. -
static async check_ignore(ctx: ServiceContext, configure: Callable[[GitCheckIgnoreSettings], GitCheckIgnoreSettings] | None=None) -> ExecResultReport which paths the ignore rules exclude:
git check-ignore. -
static async is_ignored(ctx: ServiceContext, configure: Callable[[GitCheckIgnoreSettings], GitCheckIgnoreSettings] | None=None) -> objectWhether a path is excluded, read from the exit status of
git check-ignore. -
static async blame(ctx: ServiceContext, configure: Callable[[GitBlameSettings], GitBlameSettings] | None=None) -> ExecResultAnnotate a file's lines with their commits:
git blame. -
static async blame_lines(ctx: ServiceContext, configure: Callable[[GitBlameSettings], GitBlameSettings] | None=None) -> objectThe annotated lines, parsed:
git blame --porcelain. -
static async shortlog(ctx: ServiceContext, configure: Callable[[GitShortlogSettings], GitShortlogSettings] | None=None) -> ExecResultSummarise commits by contributor:
git shortlog. -
static async shortlog_entries(ctx: ServiceContext, configure: Callable[[GitShortlogSettings], GitShortlogSettings] | None=None) -> objectThe per-contributor commit counts, parsed:
git shortlog -s. -
static async grep(ctx: ServiceContext, configure: Callable[[GitGrepSettings], GitGrepSettings] | None=None) -> ExecResultSearch tracked content:
git grep. -
static async verify_commit(ctx: ServiceContext, configure: Callable[[GitVerifyCommitSettings], GitVerifyCommitSettings] | None=None) -> ExecResultCheck a commit's signature:
git verify-commit. -
static async verify_tag(ctx: ServiceContext, configure: Callable[[GitVerifyTagSettings], GitVerifyTagSettings] | None=None) -> ExecResultCheck a tag's signature:
git verify-tag. -
static async is_signature_valid(ctx: ServiceContext, configure: Callable[[GitVerifyCommitSettings], GitVerifyCommitSettings] | None=None) -> objectWhether a commit's signature is good:
git verify-commit. -
static async is_tag_signature_valid(ctx: ServiceContext, configure: Callable[[GitVerifyTagSettings], GitVerifyTagSettings] | None=None) -> objectWhether a tag's signature is good:
git verify-tag. -
static async merge_tree(ctx: ServiceContext, configure: Callable[[GitMergeTreeSettings], GitMergeTreeSettings] | None=None) -> ExecResultMerge in memory, leaving the index and working tree alone:
git merge-tree. -
static async merges_cleanly(ctx: ServiceContext, configure: Callable[[GitMergeTreeSettings], GitMergeTreeSettings] | None=None) -> objectWhether two commits merge without conflict:
git merge-tree. -
static async run(ctx: ServiceContext, configure: Callable[[GitRunSettings], GitRunSettings] | None=None) -> ExecResultRun any other git command via
.command(...).
class GitVerifyCommitSettings(GitSettings) Settings for git verify-commit.
-
verbose() -> SelfAlso print the commit's contents (
-v). -
raw() -> SelfPrint gpg's raw status output (
--raw). -
objects(*values: str) -> SelfThe commits to verify (positional); repeatable.
class GitVerifyTagSettings(GitSettings) Settings for git verify-tag.
-
verbose() -> SelfAlso print the tag's contents (
-v). -
raw() -> SelfPrint gpg's raw status output (
--raw). -
format(value: str) -> SelfThe output format (
--format=<format>), in git's placeholder language.verify-tagaccepts this whereverify-commitdoes not. -
objects(*values: str) -> SelfThe tags to verify (positional); repeatable.
class GitWorktreeSettings(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.
-
add(path: str) -> SelfCheck a new worktree out at
path(git worktree add <path>). -
list() -> SelfList the repository's worktrees (
git worktree list). -
remove(path: str) -> SelfRemove the worktree at
path(git worktree remove <path>). -
prune() -> SelfDiscard records of worktrees whose directories are gone (
git worktree prune). -
branch(name: str) -> SelfThe branch to check out in the new worktree — or, with createBranch, the name of the branch to create there.
-
create_branch() -> SelfCreate branch rather than checking out an existing one (
-b). -
start_point(ref: str) -> SelfThe 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'sHEAD, 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() -> SelfCheck out with a detached
HEAD(--detach). -
force() -> SelfForce the operation (
--force): check out a branch already checked out elsewhere, or remove a worktree with modifications. Without it git refuses both. -
porcelain() -> SelfEmit the stable machine-readable listing (
--porcelain).