zuke.tools.git

← Python API reference

@zuke/git 1.6.0: @zuke/git — typed git task wrappers for Zuke builds.

Symbols

#

GitAddSettings

class
class GitAddSettings(GitSettings)

Settings for git add.

  • paths(*values: str) -> Self

    Paths/pathspecs to stage (positional); repeatable.

  • all() -> Self

    Stage all changes including new files (-A/--all).

  • update() -> Self

    Stage modifications and deletions, but not new files (-u/--update).

  • force() -> Self

    Stage files git would otherwise ignore (-f/--force).

  • intent_to_add() -> Self

    Record the paths' existence but not their contents (-N/--intent-to-add), which is what makes an untracked file show up in git diff.

#

GitApplySettings

class
class GitApplySettings(GitSettings)

Settings for git apply.

  • patches(*values: str) -> Self

    The patch files to apply (positional); repeatable. Reads stdin when empty.

  • check() -> Self

    Report whether the patch would apply, changing nothing (--check).

  • reverse() -> Self

    Apply the patch backwards (--reverse).

  • three_way() -> Self

    Fall back to a three-way merge when the patch does not apply cleanly (--3way), leaving conflict markers instead of refusing outright.

  • index() -> Self

    Apply to the index as well as the working tree (--index).

  • cached() -> Self

    Apply to the index only, leaving the working tree alone (--cached).

  • strip(components: float) -> Self

    Strip this many leading path components (-p<n>); git's default is 1.

  • whitespace(action: Literal['nowarn', 'warn', 'fix', 'error', 'error-all']) -> Self

    What to do about whitespace errors (--whitespace=<action>): nowarn, warn, fix, error, or error-all.

  • exclude(*patterns: str) -> Self

    Skip files matching this pattern (--exclude=<pattern>); repeatable.

#

GitArchiveSettings

class
class GitArchiveSettings(GitSettings)

Settings for git archive.

  • treeish(rev: str) -> Self

    The tree, commit, or tag to archive (positional, required).

  • format(name: str) -> Self

    The archive format (--format=<fmt>), e.g. tar, tar.gz, or zip.

  • output(path: str) -> Self

    Write to this file (--output=<file>) instead of stdout.

  • prefix(value: str) -> Self

    Prepend this path to every entry (--prefix=<prefix>/).

  • remote(name_or_url: str) -> Self

    Ask a remote repository for the archive (--remote=<repo>).

  • paths(*values: str) -> Self

    Archive only these pathspecs (positional); repeatable.

#

GitBlameSettings

class
class GitBlameSettings(GitSettings)

Settings for git blame.

  • file(path: str) -> Self

    The file to annotate (positional).

  • porcelain() -> Self

    Machine-readable output (--porcelain). Prefer "./git.ts".GitTasks.blameLines, which parses it.

  • line_porcelain() -> Self

    Like porcelain, but repeating the commit header on every line (--line-porcelain) rather than only its first appearance.

  • revision(value: str) -> Self

    Annotate the file as of this revision (positional).

  • line_range(start: float, end: float | str) -> Self

    Annotate only these lines (-L <start>,<end>); repeatable.

  • show_email() -> Self

    Show the author's email rather than their name (-e).

  • ignore_whitespace() -> Self

    Ignore whitespace-only changes when assigning blame (-w).

  • reverse(value: str) -> Self

    Walk history forward from this revision instead (--reverse <rev>).

  • ignore_revs(*revisions: str) -> Self

    Ignore a revision when assigning blame (--ignore-rev); repeatable.

#

GitBranchSettings

class
class GitBranchSettings(GitSettings)

Settings for git branch.

  • name(value: str) -> Self

    The branch name to create or operate on.

  • start_point(rev: str) -> Self

    The commit a created branch forks from (git's trailing <start-point>), e.g. origin/main.

  • delete_branch(force: bool | None=None) -> Self

    Delete the branch (-d, or -D when forced).

  • rename(new_name: str, force: bool | None=None) -> Self

    Rename name to newName (-m, or -M when forced).

  • set_upstream_to(ref: str) -> Self

    Point the branch's upstream at this ref (--set-upstream-to=<ref>).

  • all() -> Self

    List both local and remote-tracking branches (-a/--all).

  • remotes() -> Self

    List remote-tracking branches only (-r/--remotes).

  • contains(rev: str) -> Self

    List only branches containing this commit (--contains <commit>).

  • merged(ref: str) -> Self

    List only branches already merged into this ref (--merged <ref>) — the listing a cleanup target filters stale branches from.

  • format(spec: str) -> Self

    Render a listing through a format string (--format=<fmt>), e.g. %(refname:short) for bare branch names with no * marker or padding.

  • sort(key: str) -> Self

    Order a listing (--sort=<key>), e.g. -committerdate for most recent first.

#

GitCatFileSettings

class
class GitCatFileSettings(GitSettings)

Settings for git cat-file.

  • object(value: str) -> Self

    The object to read (positional), e.g. "HEAD:deno.json".

  • query(kind: Literal['type', 'size', 'exists']) -> Self

    Report an attribute rather than the contents: type (-t), size (-s), or exists (-e, which answers by exit status and prints nothing).

  • textconv() -> Self

    Run the object through its textconv filter (--textconv).

  • filters() -> Self

    Run the object through its working-tree filters (--filters).

#

GitCheckIgnoreSettings

class
class GitCheckIgnoreSettings(GitSettings)

Settings for git check-ignore.

  • quiet_output() -> Self

    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() -> Self

    Also report the rule that excluded each path (-v).

  • non_matching() -> Self

    Include the paths that are *not* excluded (-n); needs verbose.

  • no_index() -> Self

    Ignore the index when checking (--no-index).

  • nul_terminated() -> Self

    Terminate records with NUL rather than newline (-z).

  • paths(*values: str) -> Self

    The paths to check (positional); repeatable.

#

GitCheckoutSettings

class
class GitCheckoutSettings(GitSettings)

Settings for git checkout.

  • ref(target: str) -> Self

    The branch or commit to check out — or, with paths, the source to restore those paths from. Required unless paths is given.

  • paths(*paths: str) -> Self

    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() -> Self

    Create a new branch (-b).

  • detach() -> Self

    Check the ref out with a detached HEAD (--detach).

  • force() -> Self

    Force checkout, discarding local changes (-f/--force).

#

GitCherryPickSettings

class
class GitCherryPickSettings(GitReplaySettings)

Settings for git cherry-pick.

  • allow_empty() -> Self

    Keep a commit that produces no changes (--allow-empty).

  • ff() -> Self

    Fast-forward instead of rewriting when the parent matches HEAD (--ff).

#

GitCleanSettings

class
class GitCleanSettings(GitSettings)

Settings for git clean.

  • paths(*values: str) -> Self

    Limit the clean to these pathspecs (positional); repeatable.

  • force() -> Self

    Actually delete the files (-f/--force).

  • dry_run() -> Self

    List what would be deleted without deleting it (-n/--dry-run).

  • directories() -> Self

    Also remove untracked directories (-d).

  • include_ignored() -> Self

    Remove ignored files too (-x) — the switch that turns a clean into a from-scratch build, since node_modules and target/ are ignored.

  • only_ignored() -> Self

    Remove *only* ignored files (-X), keeping other untracked ones.

  • exclude(*patterns: str) -> Self

    Spare paths matching this pattern (--exclude=<pattern>); repeatable.

#

GitCloneSettings

class
class GitCloneSettings(GitSettings)

Settings for git clone.

  • repository(url: str) -> Self

    The repository URL to clone (required).

  • directory(path: str) -> Self

    Target directory for the clone.

  • branch(name: str) -> Self

    Check out a specific branch (-b/--branch).

  • depth(commits: float) -> Self

    Create a shallow clone of the given depth (--depth).

  • bare() -> Self

    Clone a bare repository (--bare).

  • filter(spec: str) -> Self

    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.

  • single_branch() -> Self

    Clone only the history of the checked-out branch (--single-branch).

  • recurse_submodules() -> Self

    Also clone submodules (--recurse-submodules).

#

GitCommitSettings

class
class GitCommitSettings(GitSettings)

Settings for git commit.

  • message(text: str) -> Self

    The commit message (-m).

  • all() -> Self

    Stage modified/deleted files before committing (-a/--all).

  • amend() -> Self

    Amend the previous commit (--amend).

  • no_edit() -> Self

    Keep the existing message when amending (--no-edit).

  • allow_empty() -> Self

    Allow a commit with no changes (--allow-empty).

  • no_verify() -> Self

    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(value: str) -> Self

    Attribute the commit to someone else (--author="Name <email>").

  • paths(*values: str) -> Self

    Commit only these pathspecs (positional); repeatable.

#

GitConfigSettings

class
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) -> Self

    Read a key's value (--get <key>).

  • get_all(key: str) -> Self

    Read every value of a multi-valued key (--get-all <key>).

  • set(key: str, value: str) -> Self

    Set a key, replacing any existing value (git config <key> <value>).

  • add(key: str, value: str) -> Self

    Add another value to a multi-valued key (--add <key> <value>).

  • unset(key: str) -> Self

    Remove a key (--unset <key>).

  • list() -> Self

    List every configured key (--list).

  • global_() -> Self

    Use the user's configuration (--global).

  • local() -> Self

    Use the repository's configuration (--local).

  • system() -> Self

    Use the machine's configuration (--system).

  • worktree() -> Self

    Use the worktree's configuration (--worktree).

  • file(path: str) -> Self

    Use a specific file (--file <path>), rather than one of the scopes.

  • default_value(value: str) -> Self

    What to report when the key is unset (--default <value>), which also makes --get exit 0 instead of 1.

#

GitDefaultBranchSettings

class
class GitDefaultBranchSettings(GitSettings)

Settings for "./git.ts".GitTasks.defaultBranch: which remote to ask, plus the global options every git task shares.

  • remote(name: str) -> Self

    The remote whose default branch is wanted (default origin).

#

GitDescribeSettings

class
class GitDescribeSettings(GitSettings)

Settings for git describe.

  • commitish(rev: str) -> Self

    The commit to describe (positional); defaults to HEAD.

  • tags() -> Self

    Consider lightweight tags too, not only annotated ones (--tags).

  • all() -> Self

    Consider every ref, not only tags (--all).

  • always() -> Self

    Fall back to an abbreviated SHA when no tag matches (--always).

  • exact_match() -> Self

    Fail unless the commit is exactly at a tag (--exact-match).

  • abbrev(length: float) -> Self

    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(suffix: str | None=None) -> Self

    Append a marker when the working tree is dirty (--dirty[=<suffix>]).

  • match_(*patterns: str) -> Self

    Only consider tags matching this glob (--match <pattern>); repeatable.

#

GitDiffSettings

class
class GitDiffSettings(GitSettings)

Settings for git diff.

  • commits(*revs: str) -> Self

    The 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) -> Self

    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(*values: str) -> Self

    Limit the diff to these pathspecs (positional, after --); repeatable.

  • staged() -> Self

    Diff the index against HEAD rather than the working tree (--staged).

  • name_only() -> Self

    List the changed paths instead of the patch (--name-only).

  • name_status() -> Self

    List the changed paths with their status letters (--name-status).

  • stat() -> Self

    Summarise the changes per file (--stat).

  • shortstat() -> Self

    One summary line for the whole diff (--shortstat).

  • unified(lines: float) -> Self

    Lines of context around each hunk (--unified=<n>).

  • ignore_all_space() -> Self

    Ignore whitespace entirely when comparing (--ignore-all-space).

  • exit_code() -> Self

    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.

  • diff_filter(letters: str) -> Self

    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.

  • nul_terminated() -> Self

    Terminate output records with a NUL rather than a newline (-z).

#

GitFetchSettings

class
class GitFetchSettings(GitSettings)

Settings for git fetch.

  • remote(name: str) -> Self

    The remote to fetch from.

  • refspec(*specs: str) -> Self

    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.

  • no_tags() -> Self

    Skip fetching tags (--no-tags).

  • depth(commits: float) -> Self

    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() -> Self

    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() -> Self

    Fetch from all remotes (--all).

  • tags() -> Self

    Also fetch tags (--tags).

  • prune() -> Self

    Prune deleted remote refs (--prune).

  • force() -> Self

    Update refs even when the update is not a fast-forward (--force).

#

GitForEachRefSettings

class
class GitForEachRefSettings(GitSettings)

Settings for git for-each-ref.

  • format(value: str) -> Self

    The output format (--format=<format>), in git's placeholder language.

  • count(value: float) -> Self

    Show only this many matched refs (--count=<n>).

  • sort(*keys: str) -> Self

    Sort by a field (--sort=<key>), e.g. "-creatordate" for newest first; repeatable, and git applies the keys in the order given.

  • exclude(*patterns: str) -> Self

    Exclude refs matching a pattern (--exclude=<pattern>); repeatable.

  • points_at(object: str) -> Self

    Only refs pointing at this object (--points-at=<object>).

  • merged(commit: str) -> Self

    Only refs merged into this commit (--merged=<commit>).

  • no_merged(commit: str) -> Self

    Only refs not merged into this commit (--no-merged=<commit>).

  • contains(commit: str) -> Self

    Only refs whose history contains this commit (--contains=<commit>).

  • no_contains(commit: str) -> Self

    Only refs not containing this commit (--no-contains=<commit>).

  • ignore_case() -> Self

    Sort and filter case-insensitively (--ignore-case).

  • omit_empty() -> Self

    Skip the newline after a ref that formats to nothing (--omit-empty).

  • patterns(*values: str) -> Self

    The ref patterns to match (positional), e.g. "refs/tags/"; repeatable.

#

GitGrepSettings

class
class GitGrepSettings(GitSettings)

Settings for git grep.

  • pattern(*values: str) -> Self

    A pattern to search for (-e <pattern>); repeatable.

  • ignore_case() -> Self

    Match case-insensitively (-i).

  • word_regexp() -> Self

    Match only at word boundaries (-w).

  • invert() -> Self

    Report the lines that do *not* match (-v).

  • line_number() -> Self

    Prefix each match with its line number (-n).

  • names_only() -> Self

    Report only the names of matching files (-l).

  • count_matches() -> Self

    Report only how many lines matched per file (-c).

  • extended_regexp() -> Self

    Read the pattern as a POSIX extended regexp (-E).

  • fixed_strings() -> Self

    Read the pattern as a literal string (-F).

  • cached() -> Self

    Search the index rather than the working tree (--cached).

  • untracked() -> Self

    Search untracked files as well as tracked ones (--untracked).

  • nul_terminated() -> Self

    Terminate output records with NUL (-z).

  • max_depth(value: float) -> Self

    Descend at most this many directories (--max-depth=<n>).

  • context(lines: float) -> Self

    Show this many lines of context around each match (-C <n>).

  • revisions(*values: str) -> Self

    Search these revisions rather than the working tree (positional).

  • paths(*values: str) -> Self

    Limit the search to these paths (positional); repeatable.

#

GitInitSettings

class
class GitInitSettings(GitSettings)

Settings for git init.

  • bare() -> Self

    Create a bare repository (--bare).

  • initial_branch(name: str) -> Self

    Name the initial branch (-b/--initial-branch).

#

GitLogSettings

class
class GitLogSettings(GitSettings)

Settings for git log.

  • revisions(*revs: str) -> Self

    Revisions to walk (positional), e.g. HEAD or origin/main; repeatable.

  • range(from_: str, to: str | None=None) -> Self

    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(*values: str) -> Self

    Limit the walk to these pathspecs (positional, after --); repeatable.

  • max_count(count: float) -> Self

    Stop after this many commits (--max-count=<n>).

  • skip(count: float) -> Self

    Skip this many commits before reporting any (--skip=<n>).

  • oneline() -> Self

    One abbreviated line per commit (--oneline).

  • format(spec: str) -> Self

    Render 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) -> Self

    Only commits more recent than this date (--since=<date>).

  • until(date: str) -> Self

    Only commits older than this date (--until=<date>).

  • author(*patterns: str) -> Self

    Only commits whose author matches this pattern (--author=); repeatable.

  • grep(*patterns: str) -> Self

    Only commits whose message matches this pattern (--grep=); repeatable.

  • no_merges() -> Self

    Skip merge commits (--no-merges).

  • first_parent() -> Self

    Follow only the first parent of a merge (--first-parent).

  • reverse() -> Self

    Report oldest first (--reverse).

  • follow() -> Self

    Keep following a single file across renames (--follow).

#

GitLsFilesSettings

class
class GitLsFilesSettings(GitSettings)

Settings for git ls-files.

  • paths(*values: str) -> Self

    Limit the listing to these pathspecs (positional); repeatable.

  • cached() -> Self

    List files in the index (--cached), git's default.

  • modified() -> Self

    List files modified in the working tree (--modified).

  • deleted() -> Self

    List files deleted from the working tree (--deleted).

  • others() -> Self

    List untracked files (--others). Pair it with excludeStandard, or the listing includes everything .gitignore covers.

  • ignored() -> Self

    List ignored files (--ignored); only meaningful with others.

  • stage() -> Self

    Show the mode, object name, and stage of each entry (--stage).

  • exclude_standard() -> Self

    Apply the standard ignore rules (--exclude-standard).

  • directory() -> Self

    Report an untracked directory once rather than every file in it (--directory).

  • error_unmatch() -> Self

    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.

  • nul_terminated() -> Self

    Terminate each entry with a NUL rather than a newline (-z).

#

GitLsRemoteSettings

class
class GitLsRemoteSettings(GitSettings)

Settings for git ls-remote.

  • remote(name_or_url: str) -> Self

    The remote (or URL) to ask; defaults to the branch's upstream.

  • patterns(*values: str) -> Self

    Limit the listing to refs matching these patterns (positional); repeatable.

  • heads() -> Self

    List branch refs only (--heads).

  • tags() -> Self

    List tag refs only (--tags).

  • refs() -> Self

    Hide peeled tags and pseudo-refs (--refs).

  • symref() -> Self

    Also report what the remote's HEAD points at (--symref).

  • exit_code() -> Self

    Exit 2 when nothing matched (--exit-code).

#

GitLsTreeSettings

class
class GitLsTreeSettings(GitSettings)

Settings for git ls-tree.

  • tree(value: str) -> Self

    The tree-ish to list (positional), e.g. "HEAD" or "v1.0.0".

  • recursive() -> Self

    Recurse into subtrees (-r).

  • trees_only() -> Self

    Show only trees, not blobs (-d).

  • show_trees() -> Self

    Show the trees themselves while recursing (-t).

  • nul_terminated() -> Self

    Terminate entries with NUL rather than newline (-z).

  • long() -> Self

    Include each object's size (--long).

  • name_only() -> Self

    List only the file names (--name-only).

  • object_only() -> Self

    List only the object names (--object-only).

  • full_name() -> Self

    Report paths from the repository root (--full-name).

  • full_tree() -> Self

    List the whole tree, not just the current directory (--full-tree).

  • abbrev(digits: float) -> Self

    Abbreviate object names to this many digits (--abbrev=<n>).

  • paths(*values: str) -> Self

    Limit the listing to these paths (positional); repeatable.

#

GitMergeBaseSettings

class
class GitMergeBaseSettings(GitSettings)

Settings for git merge-base.

  • all() -> Self

    Output every common ancestor rather than one (--all).

  • octopus() -> Self

    Find the ancestors for a single n-way merge (--octopus).

  • independent() -> Self

    List the revisions not reachable from any other (--independent).

  • is_ancestor() -> Self

    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.

  • fork_point() -> Self

    Find where a commit forked from a ref's reflog (--fork-point).

  • commits(*values: str) -> Self

    The commits to consider (positional); repeatable.

#

GitMergeSettings

class
class GitMergeSettings(GitSequencerSettings)

Settings for git merge.

  • refs(*values: str) -> Self

    The commits to merge into the current branch (positional); repeatable.

  • message(text: str) -> Self

    The merge commit's message (-m).

  • no_ff() -> Self

    Always create a merge commit (--no-ff), even when a fast-forward would do.

  • ff_only() -> Self

    Refuse anything but a fast-forward (--ff-only).

  • squash() -> Self

    Stage the merged result without recording a merge (--squash).

  • no_commit() -> Self

    Merge but leave the commit to the caller (--no-commit).

  • strategy(name: str) -> Self

    The merge strategy (--strategy=<name>), e.g. ours.

  • strategy_option(*options: str) -> Self

    An option for the strategy (--strategy-option=<option>), e.g. theirs to resolve conflicting hunks in favour of the merged branch; repeatable.

  • allow_unrelated_histories() -> Self

    Merge histories that share no commit (--allow-unrelated-histories).

#

GitMergeTreeSettings

class
class GitMergeTreeSettings(GitSettings)

Settings for git merge-tree.

  • write_tree() -> Self

    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() -> Self

    Also print the informational and conflict messages (--messages).

  • name_only() -> Self

    List conflicted filenames without modes or object names (--name-only).

  • nul_terminated() -> Self

    Separate paths with NUL rather than newline (-z).

  • allow_unrelated_histories() -> Self

    Permit merging histories with no common ancestor (--allow-unrelated-histories).

  • merge_base(commit: str) -> Self

    Use this commit as the merge base (--merge-base=<commit>).

  • branches(*values: str) -> Self

    The two branches to merge (positional).

#

GitMvSettings

class
class GitMvSettings(GitSettings)

Settings for git mv.

  • sources(*values: str) -> Self

    The path(s) to move (positional, required); repeatable.

  • destination(path: str) -> Self

    Where they move to (required): a file name for a single source, a directory when there is more than one.

  • force() -> Self

    Overwrite an existing destination (-f/--force).

  • dry_run() -> Self

    Report what would move without moving it (-n/--dry-run).

#

GitNameRevSettings

class
class GitNameRevSettings(GitSettings)

Settings for git name-rev.

  • tags() -> Self

    Use only tags to name the commits (--tags).

  • all() -> Self

    Name every reachable commit (--all).

  • name_only() -> Self

    Print only the name, not the commit it names (--name-only).

  • always_name() -> Self

    Fall back to the object name when nothing else names it (--always).

  • refs(*patterns: str) -> Self

    Only consider refs matching these patterns (--refs=<pattern>).

  • commits(*values: str) -> Self

    The commits to name (positional); repeatable.

#

GitPullSettings

class
class GitPullSettings(GitSettings)

Settings for git pull.

  • remote(name: str) -> Self

    The remote to pull from.

  • ref(value: str) -> Self

    The refspec/branch to pull.

  • rebase() -> Self

    Rebase instead of merge (--rebase).

  • no_rebase() -> Self

    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.

  • ff_only() -> Self

    Only fast-forward (--ff-only).

  • depth(commits: float) -> Self

    Limit the fetched history to this many commits (--depth).

  • tags() -> Self

    Also fetch tags (--tags).

  • prune() -> Self

    Prune deleted remote refs while fetching (--prune).

#

GitPushSettings

class
class GitPushSettings(GitSettings)

Settings for git push.

  • remote(name: str) -> Self

    The remote to push to (e.g. origin).

  • ref(value: str) -> Self

    The refspec/branch to push.

  • set_upstream() -> Self

    Set the upstream tracking ref (-u/--set-upstream).

  • tags() -> Self

    Also push tags (--tags).

  • follow_tags() -> Self

    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.

  • force_with_lease() -> Self

    Force push, but only if the remote ref is unchanged (--force-with-lease).

  • delete_ref() -> Self

    Delete the remote ref (--delete).

  • atomic() -> Self

    Update every ref or none (--atomic).

  • dry_run() -> Self

    Report what would be pushed without pushing it (--dry-run).

  • push_option(*values: str) -> Self

    Send a server-side option (--push-option=<value>); repeatable. GitLab reads these for ci.skip and merge-request creation.

#

GitRebaseSettings

class
class GitRebaseSettings(GitSequencerSettings)

Settings for git rebase.

  • upstream(rev: str) -> Self

    The commit the current branch is replayed onto (positional).

  • branch(name: str) -> Self

    Rebase this branch rather than the checked-out one (git's <branch>).

  • onto(rev: str) -> Self

    Replay onto a different base than the upstream (--onto <newbase>).

  • autosquash() -> Self

    Fold fixup!/squash! commits into their targets (--autosquash).

  • autostash() -> Self

    Stash local changes and restore them afterwards (--autostash), instead of refusing to start on a dirty tree.

  • keep_empty() -> Self

    Keep commits that produce no changes (--keep-empty).

  • rebase_merges() -> Self

    Recreate merge commits rather than flattening them (--rebase-merges).

  • strategy(name: str) -> Self

    The merge strategy used to replay each commit (--strategy=<name>).

  • strategy_option(*options: str) -> Self

    An option for that strategy (--strategy-option=<option>); repeatable.

  • skip() -> Self

    Drop the current commit and carry on (--skip).

#

GitRemoteSettings

class
class GitRemoteSettings(GitSettings)

Settings for git remote. Pick the subcommand with list, add, remove, rename, setUrl, getUrl, show, or prune.

  • list() -> Self

    List the configured remotes (git remote), the default.

  • add(name: str, url: str) -> Self

    Add a remote (git remote add <name> <url>).

  • remove(name: str) -> Self

    Remove a remote and its tracking refs (git remote remove <name>).

  • rename(old_name: str, new_name: str) -> Self

    Rename a remote (git remote rename <old> <new>).

  • set_url(name: str, url: str) -> Self

    Change a remote's URL (git remote set-url <name> <url>). Add pushUrl to change only the push URL.

  • get_url(name: str) -> Self

    Print a remote's URL (git remote get-url <name>).

  • show(name: str) -> Self

    Describe a remote and its branches (git remote show <name>).

  • prune(name: str) -> Self

    Delete tracking refs the remote no longer has (git remote prune <name>).

  • verbose() -> Self

    Show each remote's URLs when listing (-v/--verbose).

  • fetch() -> Self

    Fetch from the remote right after adding it (-f, add only).

  • track(branch: str) -> Self

    Track only this branch (-t <branch>, add only).

  • push_url() -> Self

    Operate on the push URL (--push), for setUrl and getUrl.

#

GitReplaySettings

class
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) -> Self

    The commits to replay (positional, required); repeatable.

  • no_commit() -> Self

    Apply the change without committing it (-n/--no-commit).

  • mainline(parent: float) -> Self

    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() -> Self

    Add a Signed-off-by trailer (--signoff).

  • skip() -> Self

    Drop the current commit and carry on (--skip).

#

GitResetSettings

class
class GitResetSettings(GitSettings)

Settings for git reset.

  • ref(rev: str) -> Self

    The commit to reset to (positional); defaults to HEAD.

  • paths(*values: str) -> Self

    Reset only these pathspecs — unstaging them (positional); repeatable.

  • soft() -> Self

    Move the branch only, keeping the index and working tree (--soft).

  • mixed() -> Self

    Reset the index but not the working tree (--mixed), git's default.

  • hard() -> Self

    Reset the index *and* the working tree (--hard), discarding changes.

  • merge() -> Self

    Reset, keeping changes to files that differ between the commits (--merge).

  • keep() -> Self

    Like merge, but refuse when a changed file differs (--keep).

#

GitRestoreSettings

class
class GitRestoreSettings(GitSettings)

Settings for git restore.

  • paths(*values: str) -> Self

    The pathspecs to restore (positional, required); repeatable.

  • source(treeish: str) -> Self

    Restore the contents from this commit or tree (--source=<tree-ish>) rather than from the index.

  • staged() -> Self

    Restore the index (--staged) — unstaging the paths. Combine with worktree to reset both, which is what git restore -SW does.

  • worktree() -> Self

    Restore the working tree (--worktree), git's default when neither is given.

#

GitRevertSettings

class
class GitRevertSettings(GitReplaySettings)

Settings for git revert.

  • no_edit() -> Self

    Take the generated message without opening an editor (--no-edit).

#

GitRevListSettings

class
class GitRevListSettings(GitSettings)

Settings for git rev-list.

  • count() -> Self

    Print 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) -> Self

    Stop after this many commits (--max-count=<n>).

  • skip(value: float) -> Self

    Skip this many commits before printing (--skip=<n>).

  • all() -> Self

    Walk every ref in refs/ (--all).

  • branches() -> Self

    Walk every branch (--branches).

  • tags() -> Self

    Walk every tag (--tags).

  • remotes() -> Self

    Walk every remote-tracking branch (--remotes).

  • no_merges() -> Self

    Omit merge commits (--no-merges).

  • merges() -> Self

    Keep only merge commits (--merges).

  • first_parent() -> Self

    Follow only the first parent of each merge (--first-parent).

  • reverse() -> Self

    Emit the commits oldest first (--reverse).

  • topo_order() -> Self

    Order by topology rather than date (--topo-order).

  • date_order() -> Self

    Order by commit date (--date-order).

  • since(value: str) -> Self

    Only commits after this date (--since=<date>).

  • until(value: str) -> Self

    Only commits before this date (--until=<date>).

  • author(pattern: str) -> Self

    Only commits whose author matches (--author=<pattern>).

  • commits(*values: str) -> Self

    The commits or ranges to walk (positional), e.g. "HEAD" or "origin/main..HEAD"; repeatable.

  • paths(*values: str) -> Self

    Limit the walk to commits touching these paths (positional); repeatable.

#

GitRevParseSettings

class
class GitRevParseSettings(GitSettings)

Settings for git rev-parse.

  • rev(*values: str) -> Self

    The revisions or arguments to resolve (positional); repeatable.

  • short(length: float | None=None) -> Self

    Abbreviate the SHA (--short, or --short=<n> with a length). git picks a length long enough to stay unambiguous when none is given.

  • abbrev_ref() -> Self

    Print the ref's short name (--abbrev-ref), e.g. main for HEAD.

  • verify() -> Self

    Fail rather than echo the argument when it names no object (--verify).

  • git_dir() -> Self

    Print the path of the .git directory (--git-dir).

  • show_toplevel() -> Self

    Print the absolute path of the working tree's root (--show-toplevel).

  • show_prefix() -> Self

    Print the current directory's path relative to that root (--show-prefix).

  • is_inside_work_tree() -> Self

    Print whether this is inside a working tree (--is-inside-work-tree).

#

GitRmSettings

class
class GitRmSettings(GitSettings)

Settings for git rm.

  • paths(*values: str) -> Self

    Paths/pathspecs to remove (positional, required); repeatable.

  • cached() -> Self

    Remove from the index only, leaving the file on disk (--cached) — how a file committed by mistake stops being tracked without being deleted.

  • recursive() -> Self

    Recurse into directories (-r).

  • force() -> Self

    Remove even when the file has staged or local changes (-f/--force).

  • dry_run() -> Self

    Report what would be removed without removing it (-n/--dry-run).

  • ignore_unmatch() -> Self

    Exit 0 when no path matches (--ignore-unmatch).

#

GitRunSettings

class
class GitRunSettings(GitSettings)

Settings for an arbitrary git command not covered by a typed task.

  • command(*parts: str | float) -> Self

    The subcommand and its arguments, e.g. command("bisect", "start").

#

GitSequencerSettings

class
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_() -> Self

    Resume the operation once the conflict is resolved (--continue).

  • abort() -> Self

    Undo it and restore the pre-operation state (--abort).

  • quit() -> Self

    Forget the operation, leaving the tree as it is (--quit).

#

GitSettings

class
class GitSettings(ToolSettings)

Shared base for every git subcommand: the binary and global options.

  • dir(path: str) -> Self

    Run git as if started in path (-C <path>).

  • config(key: str, value: str) -> Self

    Set a one-off config value (-c key=value); repeatable.

#

GitShortlogSettings

class
class GitShortlogSettings(GitSettings)

Settings for git shortlog.

  • summary() -> Self

    Report only the commit count per author, without the subjects (-s). Prefer "./git.ts".GitTasks.shortlogEntries, which reads that output back.

  • numbered() -> Self

    Sort by commit count rather than by name (-n).

  • email() -> Self

    Include each author's email address (-e).

  • committer() -> Self

    Group by committer rather than author (-c).

  • group(*fields: str) -> Self

    Group by a named field (--group=<field>), e.g. "trailer:co-authored-by".

  • commits(*values: str) -> Self

    The revision range to summarise (positional); repeatable.

  • paths(*values: str) -> Self

    Limit the summary to commits touching these paths (positional).

#

GitShowRefSettings

class
class GitShowRefSettings(GitSettings)

Settings for git show-ref.

  • tags() -> Self

    Only tags (--tags); may be combined with heads.

  • heads() -> Self

    Only branch heads (--heads); may be combined with tags.

  • head() -> Self

    Include HEAD even when a filter would exclude it (--head).

  • dereference() -> Self

    Dereference tags into the objects they point at (--dereference).

  • hash() -> Self

    Print only the object name, without the ref (--hash).

  • verify() -> Self

    Require an exact ref path and fail otherwise (--verify).

  • exists() -> Self

    Check a ref exists without resolving it (--exists).

  • quiet_output() -> Self

    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(digits: float) -> Self

    Abbreviate object names to this many digits (--abbrev=<n>).

  • patterns(*values: str) -> Self

    The ref patterns to show (positional); repeatable.

#

GitShowSettings

class
class GitShowSettings(GitSettings)

Settings for git show.

  • object(*names: str) -> Self

    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(*values: str) -> Self

    Limit the output to these pathspecs (positional, after --); repeatable.

  • format(spec: str) -> Self

    Render the commit header through a format string (--format=<fmt>).

  • no_patch() -> Self

    Suppress the diff (--no-patch), leaving only the header.

  • name_only() -> Self

    List the changed paths instead of the diff (--name-only).

  • name_status() -> Self

    List the changed paths with their status letters (--name-status).

  • stat() -> Self

    Summarise the changes (--stat).

#

GitStashSettings

class
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() -> Self

    Stash the working tree and index (git stash push).

  • pop() -> Self

    Restore a stash and drop it (git stash pop).

  • apply() -> Self

    Restore a stash and keep it (git stash apply).

  • list() -> Self

    List the stashes (git stash list).

  • show() -> Self

    Show a stash's diff (git stash show).

  • drop() -> Self

    Discard a stash (git stash drop).

  • clear() -> Self

    Discard every stash (git stash clear).

  • stash(ref: str) -> Self

    Which 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) -> Self

    Label the stash being pushed (-m).

  • include_untracked() -> Self

    Stash untracked files too (--include-untracked).

  • keep_index() -> Self

    Leave what is already staged in the index (--keep-index).

  • staged() -> Self

    Stash only what is staged (--staged).

  • paths(*values: str) -> Self

    Stash only these pathspecs (positional, after --); repeatable.

#

GitStatusSettings

class
class GitStatusSettings(GitSettings)

Settings for git status.

  • short() -> Self

    Short-format output (-s/--short).

  • porcelain() -> Self

    Stable machine-readable output (--porcelain).

  • branch() -> Self

    Show branch information (-b/--branch).

  • nul_terminated() -> Self

    Terminate each record with a NUL rather than a newline (-z), which also turns on --porcelain and stops git quoting unusual paths.

  • untracked_files(mode: Literal['no', 'normal', 'all']) -> Self

    How much of an untracked directory to report (--untracked-files=<mode>): no, normal (the default — the directory), or all (every file in it).

  • ignored() -> Self

    Also report ignored files (--ignored).

  • paths(*values: str) -> Self

    Limit the report to these pathspecs (positional); repeatable.

#

GitSubmoduleSettings

class
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) -> Self

    Add a submodule (git submodule add <url> [<path>]).

  • init() -> Self

    Register the submodules in .gitmodules (git submodule init).

  • deinit() -> Self

    Unregister submodules (git submodule deinit).

  • update() -> Self

    Check the submodules out at their recorded commits (git submodule update).

  • sync() -> Self

    Copy the configured URLs into .git/config (git submodule sync).

  • status() -> Self

    Report each submodule's checked-out commit (git submodule status).

  • foreach(*command: str) -> Self

    Run a command in each submodule (git submodule foreach <command>).

  • paths(*values: str) -> Self

    Limit the operation to these paths (positional); repeatable.

  • with_init() -> Self

    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() -> Self

    Recurse into nested submodules (--recursive).

  • remote() -> Self

    Use the upstream branch's latest commit rather than the recorded one (--remote).

  • force() -> Self

    Discard local changes in the submodule (--force).

  • depth(commits: float) -> Self

    Clone the submodules shallowly (--depth <n>).

  • jobs(count: float) -> Self

    Clone this many submodules in parallel (--jobs <n>).

  • branch(name: str) -> Self

    Track this branch when adding or updating (-b <branch>).

#

GitSwitchSettings

class
class GitSwitchSettings(GitSettings)

Settings for git switch.

  • branch(name: str) -> Self

    The branch to switch to — or, with create, the one to create.

  • start_point(rev: str) -> Self

    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() -> Self

    Create the branch (-c); fails if it already exists.

  • force_create() -> Self

    Create the branch, resetting it if it exists (-C).

  • track(mode: Literal['direct', 'inherit']) -> Self

    Set up upstream tracking (--track=<mode>), direct or inherit.

  • detach() -> Self

    Switch with a detached HEAD (--detach) — checking out a commit rather than a branch, which switch otherwise refuses.

  • force() -> Self

    Throw away local changes rather than refusing to switch (--force).

#

GitSymbolicRefSettings

class
class GitSymbolicRefSettings(GitSettings)

Settings for git symbolic-ref.

  • name(value: str) -> Self

    The symbolic ref to read or set (positional), e.g. "HEAD".

  • ref(value: str) -> Self

    The ref to point it at (positional), which makes this a write.

  • short() -> Self

    Shorten the reported ref name (--short).

  • delete() -> Self

    Delete the symbolic ref (--delete).

  • quiet_output() -> Self

    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(value: str) -> Self

    The reflog reason to record for the update (-m <reason>).

#

GitTagSettings

class
class GitTagSettings(GitSettings)

Settings for git tag.

  • name(value: str) -> Self

    The tag name.

  • commit(rev: str) -> Self

    The commit to tag (git's trailing <commit>), rather than HEAD. Only meaningful when creating a tag.

  • message(text: str) -> Self

    Create an annotated tag with this message (-a -m).

  • force() -> Self

    Replace an existing tag (-f/--force).

  • delete_tag() -> Self

    Delete the tag (-d/--delete).

  • list(pattern: str | None=None) -> Self

    List tags (-l), optionally matching a shell pattern such as v1.*. With no pattern, lists them all.

  • sort(key: str) -> Self

    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.

#

GitTasks

class
class GitTasks

Typed task functions for the git commands.

  • static async init(ctx: ServiceContext, configure: Callable[[GitInitSettings], GitInitSettings] | None=None) -> ExecResult

    Create a repository: git init.

  • static async clone(ctx: ServiceContext, configure: Callable[[GitCloneSettings], GitCloneSettings] | None=None) -> ExecResult

    Clone a repository: git clone.

  • static async add(ctx: ServiceContext, configure: Callable[[GitAddSettings], GitAddSettings] | None=None) -> ExecResult

    Stage changes: git add.

  • static async rm(ctx: ServiceContext, configure: Callable[[GitRmSettings], GitRmSettings] | None=None) -> ExecResult

    Remove tracked files: git rm.

  • static async mv(ctx: ServiceContext, configure: Callable[[GitMvSettings], GitMvSettings] | None=None) -> ExecResult

    Move or rename a tracked file: git mv.

  • static async restore(ctx: ServiceContext, configure: Callable[[GitRestoreSettings], GitRestoreSettings] | None=None) -> ExecResult

    Restore working-tree or index contents: git restore.

  • static async clean(ctx: ServiceContext, configure: Callable[[GitCleanSettings], GitCleanSettings] | None=None) -> ExecResult

    Delete untracked files: git clean.

  • static async commit(ctx: ServiceContext, configure: Callable[[GitCommitSettings], GitCommitSettings] | None=None) -> ExecResult

    Record changes: git commit.

  • static async status(ctx: ServiceContext, configure: Callable[[GitStatusSettings], GitStatusSettings] | None=None) -> ExecResult

    Show working-tree status: git status.

  • static async status_entries(ctx: ServiceContext, configure: Callable[[GitStatusSettings], GitStatusSettings] | None=None) -> object

    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.

  • static async checkout(ctx: ServiceContext, configure: Callable[[GitCheckoutSettings], GitCheckoutSettings] | None=None) -> ExecResult

    Switch branches or restore files: git checkout.

  • static async switch(ctx: ServiceContext, configure: Callable[[GitSwitchSettings], GitSwitchSettings] | None=None) -> ExecResult

    Switch branches: git switch, checkout's modern half.

  • static async branch(ctx: ServiceContext, configure: Callable[[GitBranchSettings], GitBranchSettings] | None=None) -> ExecResult

    Manage branches: git branch.

  • static async tag(ctx: ServiceContext, configure: Callable[[GitTagSettings], GitTagSettings] | None=None) -> ExecResult

    Manage tags: git tag.

  • static async push(ctx: ServiceContext, configure: Callable[[GitPushSettings], GitPushSettings] | None=None) -> ExecResult

    Update remote refs: git push.

  • static async pull(ctx: ServiceContext, configure: Callable[[GitPullSettings], GitPullSettings] | None=None) -> ExecResult

    Fetch and integrate: git pull.

  • static async fetch(ctx: ServiceContext, configure: Callable[[GitFetchSettings], GitFetchSettings] | None=None) -> ExecResult

    Download objects and refs: git fetch.

  • static async remote(ctx: ServiceContext, configure: Callable[[GitRemoteSettings], GitRemoteSettings] | None=None) -> ExecResult

    Manage remotes: git remote add|remove|rename|set-url|get-url|show|prune.

  • static async remote_list(ctx: ServiceContext, configure: Callable[[GitRemoteSettings], GitRemoteSettings] | None=None) -> object

    The 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) -> ExecResult

    List a remote's refs without fetching them: git ls-remote.

  • static async log(ctx: ServiceContext, configure: Callable[[GitLogSettings], GitLogSettings] | None=None) -> ExecResult

    Show history: git log.

  • static async log_entries(ctx: ServiceContext, configure: Callable[[GitLogSettings], GitLogSettings] | None=None) -> object

    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.

  • static async show(ctx: ServiceContext, configure: Callable[[GitShowSettings], GitShowSettings] | None=None) -> ExecResult

    Show an object: git show.

  • static async diff(ctx: ServiceContext, configure: Callable[[GitDiffSettings], GitDiffSettings] | None=None) -> ExecResult

    Show changes: git diff.

  • static async diff_names(ctx: ServiceContext, configure: Callable[[GitDiffSettings], GitDiffSettings] | None=None) -> object

    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.

  • static async ls_files(ctx: ServiceContext, configure: Callable[[GitLsFilesSettings], GitLsFilesSettings] | None=None) -> ExecResult

    List index and working-tree files: git ls-files.

  • static async ls_file_names(ctx: ServiceContext, configure: Callable[[GitLsFilesSettings], GitLsFilesSettings] | None=None) -> object

    The paths of a git ls-files -z listing — git's own file list, ignore rules already applied.

  • static async rev_parse(ctx: ServiceContext, configure: Callable[[GitRevParseSettings], GitRevParseSettings] | None=None) -> ExecResult

    Resolve revisions and repository paths: git rev-parse.

  • static async revision(ctx: ServiceContext, configure: Callable[[GitRevParseSettings], GitRevParseSettings] | None=None) -> object

    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.

  • static async describe(ctx: ServiceContext, configure: Callable[[GitDescribeSettings], GitDescribeSettings] | None=None) -> ExecResult

    Name a commit after the nearest tag: git describe.

  • static async merge(ctx: ServiceContext, configure: Callable[[GitMergeSettings], GitMergeSettings] | None=None) -> ExecResult

    Join two histories: git merge.

  • static async rebase(ctx: ServiceContext, configure: Callable[[GitRebaseSettings], GitRebaseSettings] | None=None) -> ExecResult

    Replay commits onto another base: git rebase.

  • static async cherry_pick(ctx: ServiceContext, configure: Callable[[GitCherryPickSettings], GitCherryPickSettings] | None=None) -> ExecResult

    Apply existing commits here: git cherry-pick.

  • static async revert(ctx: ServiceContext, configure: Callable[[GitRevertSettings], GitRevertSettings] | None=None) -> ExecResult

    Undo commits with new ones: git revert.

  • static async reset(ctx: ServiceContext, configure: Callable[[GitResetSettings], GitResetSettings] | None=None) -> ExecResult

    Move the branch, index, and optionally the working tree: git reset.

  • static async stash(ctx: ServiceContext, configure: Callable[[GitStashSettings], GitStashSettings] | None=None) -> ExecResult

    Park and restore uncommitted work: git stash.

  • static async config(ctx: ServiceContext, configure: Callable[[GitConfigSettings], GitConfigSettings] | None=None) -> ExecResult

    Read or write configuration: git config.

  • static async config_get(ctx: ServiceContext, configure: Callable[[GitConfigSettings], GitConfigSettings] | None=None) -> object

    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(...).

  • static async submodule(ctx: ServiceContext, configure: Callable[[GitSubmoduleSettings], GitSubmoduleSettings] | None=None) -> ExecResult

    Manage submodules: git submodule add|init|update|sync|status|foreach.

  • static async archive(ctx: ServiceContext, configure: Callable[[GitArchiveSettings], GitArchiveSettings] | None=None) -> ExecResult

    Package a tree as a tarball or zip: git archive.

  • static async apply(ctx: ServiceContext, configure: Callable[[GitApplySettings], GitApplySettings] | None=None) -> ExecResult

    Apply a patch file: git apply.

  • static async worktree(ctx: ServiceContext, configure: Callable[[GitWorktreeSettings], GitWorktreeSettings] | None=None) -> ExecResult

    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.

  • static async worktree_list(ctx: ServiceContext, configure: Callable[[GitWorktreeSettings], GitWorktreeSettings] | None=None) -> object

    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.

  • static async default_branch(ctx: ServiceContext, configure: Callable[[GitDefaultBranchSettings], GitDefaultBranchSettings] | None=None) -> object

    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.

  • static async merge_base(ctx: ServiceContext, configure: Callable[[GitMergeBaseSettings], GitMergeBaseSettings] | None=None) -> object

    Find the common ancestor of commits: git merge-base.

  • static async is_ancestor(ctx: ServiceContext, configure: Callable[[GitMergeBaseSettings], GitMergeBaseSettings] | None=None) -> object

    Whether 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) -> ExecResult

    Walk history as a list of commits: git rev-list.

  • static async commit_count(ctx: ServiceContext, configure: Callable[[GitRevListSettings], GitRevListSettings] | None=None) -> object

    How many commits the walk holds: git rev-list --count.

  • static async for_each_ref(ctx: ServiceContext, configure: Callable[[GitForEachRefSettings], GitForEachRefSettings] | None=None) -> ExecResult

    List refs with a format: git for-each-ref.

  • static async refs(ctx: ServiceContext, configure: Callable[[GitForEachRefSettings], GitForEachRefSettings] | None=None) -> object

    The refs and what they point at, parsed: git for-each-ref.

  • static async show_ref(ctx: ServiceContext, configure: Callable[[GitShowRefSettings], GitShowRefSettings] | None=None) -> ExecResult

    List or verify local refs: git show-ref.

  • static async symbolic_ref(ctx: ServiceContext, configure: Callable[[GitSymbolicRefSettings], GitSymbolicRefSettings] | None=None) -> ExecResult

    Read or set a symbolic ref: git symbolic-ref.

  • static async name_rev(ctx: ServiceContext, configure: Callable[[GitNameRevSettings], GitNameRevSettings] | None=None) -> ExecResult

    Find symbolic names for commits: git name-rev.

  • static async ls_tree(ctx: ServiceContext, configure: Callable[[GitLsTreeSettings], GitLsTreeSettings] | None=None) -> ExecResult

    List the contents of a tree: git ls-tree.

  • static async tree_entries(ctx: ServiceContext, configure: Callable[[GitLsTreeSettings], GitLsTreeSettings] | None=None) -> object

    The entries of a tree, parsed: git ls-tree -z.

  • static async cat_file(ctx: ServiceContext, configure: Callable[[GitCatFileSettings], GitCatFileSettings] | None=None) -> ExecResult

    Read an object's contents or attributes: git cat-file.

  • static async blob_text(ctx: ServiceContext, configure: Callable[[GitCatFileSettings], GitCatFileSettings] | None=None) -> object

    An object's contents as text, untrimmed: git cat-file -p.

  • static async check_ignore(ctx: ServiceContext, configure: Callable[[GitCheckIgnoreSettings], GitCheckIgnoreSettings] | None=None) -> ExecResult

    Report which paths the ignore rules exclude: git check-ignore.

  • static async is_ignored(ctx: ServiceContext, configure: Callable[[GitCheckIgnoreSettings], GitCheckIgnoreSettings] | None=None) -> object

    Whether a path is excluded, read from the exit status of git check-ignore.

  • static async blame(ctx: ServiceContext, configure: Callable[[GitBlameSettings], GitBlameSettings] | None=None) -> ExecResult

    Annotate a file's lines with their commits: git blame.

  • static async blame_lines(ctx: ServiceContext, configure: Callable[[GitBlameSettings], GitBlameSettings] | None=None) -> object

    The annotated lines, parsed: git blame --porcelain.

  • static async shortlog(ctx: ServiceContext, configure: Callable[[GitShortlogSettings], GitShortlogSettings] | None=None) -> ExecResult

    Summarise commits by contributor: git shortlog.

  • static async shortlog_entries(ctx: ServiceContext, configure: Callable[[GitShortlogSettings], GitShortlogSettings] | None=None) -> object

    The per-contributor commit counts, parsed: git shortlog -s.

  • static async grep(ctx: ServiceContext, configure: Callable[[GitGrepSettings], GitGrepSettings] | None=None) -> ExecResult

    Search tracked content: git grep.

  • static async verify_commit(ctx: ServiceContext, configure: Callable[[GitVerifyCommitSettings], GitVerifyCommitSettings] | None=None) -> ExecResult

    Check a commit's signature: git verify-commit.

  • static async verify_tag(ctx: ServiceContext, configure: Callable[[GitVerifyTagSettings], GitVerifyTagSettings] | None=None) -> ExecResult

    Check a tag's signature: git verify-tag.

  • static async is_signature_valid(ctx: ServiceContext, configure: Callable[[GitVerifyCommitSettings], GitVerifyCommitSettings] | None=None) -> object

    Whether a commit's signature is good: git verify-commit.

  • static async is_tag_signature_valid(ctx: ServiceContext, configure: Callable[[GitVerifyTagSettings], GitVerifyTagSettings] | None=None) -> object

    Whether a tag's signature is good: git verify-tag.

  • static async merge_tree(ctx: ServiceContext, configure: Callable[[GitMergeTreeSettings], GitMergeTreeSettings] | None=None) -> ExecResult

    Merge in memory, leaving the index and working tree alone: git merge-tree.

  • static async merges_cleanly(ctx: ServiceContext, configure: Callable[[GitMergeTreeSettings], GitMergeTreeSettings] | None=None) -> object

    Whether two commits merge without conflict: git merge-tree.

  • static async run(ctx: ServiceContext, configure: Callable[[GitRunSettings], GitRunSettings] | None=None) -> ExecResult

    Run any other git command via .command(...).

#

GitVerifyCommitSettings

class
class GitVerifyCommitSettings(GitSettings)

Settings for git verify-commit.

  • verbose() -> Self

    Also print the commit's contents (-v).

  • raw() -> Self

    Print gpg's raw status output (--raw).

  • objects(*values: str) -> Self

    The commits to verify (positional); repeatable.

#

GitVerifyTagSettings

class
class GitVerifyTagSettings(GitSettings)

Settings for git verify-tag.

  • verbose() -> Self

    Also print the tag's contents (-v).

  • raw() -> Self

    Print gpg's raw status output (--raw).

  • format(value: str) -> Self

    The output format (--format=<format>), in git's placeholder language. verify-tag accepts this where verify-commit does not.

  • objects(*values: str) -> Self

    The tags to verify (positional); repeatable.

#

GitWorktreeSettings

class
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) -> Self

    Check a new worktree out at path (git worktree add <path>).

  • list() -> Self

    List the repository's worktrees (git worktree list).

  • remove(path: str) -> Self

    Remove the worktree at path (git worktree remove <path>).

  • prune() -> Self

    Discard records of worktrees whose directories are gone (git worktree prune).

  • branch(name: str) -> Self

    The branch to check out in the new worktree — or, with createBranch, the name of the branch to create there.

  • create_branch() -> Self

    Create branch rather than checking out an existing one (-b).

  • start_point(ref: str) -> Self

    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() -> Self

    Check out with a detached HEAD (--detach).

  • force() -> Self

    Force the operation (--force): check out a branch already checked out elsewhere, or remove a worktree with modifications. Without it git refuses both.

  • porcelain() -> Self

    Emit the stable machine-readable listing (--porcelain).