Skip to main content

Module git

Module git 

Source

Functions§

apply_cached
Stage a unified-0 patch into the index. --unidiff-zero is required for git to accept the zero-context hunks absorb works with.
blame_line_shas
The distinct commits that last touched lines start..start+len of file in HEAD, newest blame wins per line. An empty range yields nothing.
branch_sha
The commit a branch points at, or None when the branch does not exist.
checkout
commit_fixup
Commit the staged index as a fixup! of sha, for a later autosquash rebase to fold in. Skips hooks: these are internal, transient commits.
commit_subject
A commit’s subject line.
commits_behind
How many commits parent has that branch does not: nonzero means the branch needs a restack.
config_get
config_get_bool
config_get_regexp
config_set
config_unset
create_branch
current_branch
delete_branch
Force-delete a branch. Callers are expected to have verified the branch landed through review state: after a squash merge its commits are not ancestry-merged, so git branch -d can refuse even though the work is in.
diff_against_head
A unified-0 diff against HEAD: just the staged changes when cached, otherwise all tracked changes (staged and unstaged). Zero context lines so each hunk’s pre-image range pinpoints exactly the lines it touches.
fetch_branch
Fast-forward a local branch from its remote without checking it out.
git_path
is_ancestor
local_branches
merge_base
pull_ff_only
push_force_with_lease
push_set_upstream_force_with_lease
Push branches and set upstream tracking; used before submitting so new branches exist remotely and rebased ones are safely updated.
rebase
rebase_abort
rebase_autosquash
Rebase base..HEAD, folding fixup! commits into their targets. The generated todo is accepted unedited, so it needs no terminal.
rebase_continue
rebase_onto
Rebase only the commits after base, replaying base..branch onto parent. Used when the recorded fork point is known so commits that landed upstream by squash or rebase are not replayed.
remote_default_branch
Default branch of remote (from its locally-known HEAD symref), if any.
remote_url
rename_branch
Rename a branch; git moves its branch.<name>.* config along with it.
reset_hard
Reset the worktree and index to HEAD. Safe to lose nothing only on a clean tree; callers must check worktree_is_clean first.
reset_index
Unstage everything, leaving the worktree contents untouched.
reset_soft
Move HEAD to sha, returning any commits after it to the index.
rev_list
The commits in range (e.g. “main..HEAD”), newest first.
rev_parse
set_verbose
Pass raw git output through instead of capturing it.
stash_pop
Restore the most recently stashed changes.
stash_push
Stash tracked worktree changes; pair with stash_pop.
supports_rebase_update_refs
update_ref
Point a branch at a commit, creating it if absent. Does not touch the worktree.
worktree_is_clean
Whether the worktree and index have no uncommitted changes.