Expand description
Git plumbing.
magi drives the git CLI rather than linking a library: every operation it
needs is a one-liner, and shelling out keeps the behaviour identical to what
the operator sees when they inspect a run by hand.
Structs§
- GitOut
- Output of a completed
gitinvocation.
Functions§
- branch_
delete - Delete a branch, ignoring “not found”.
- branch_
exists - Does
branchexist? - changed_
files - Number of files touched by
base...head. - commit_
all - Stage everything and commit under a neutral identity.
- commits_
ahead - How many commits
headis ahead ofbase. - current_
branch - Currently checked-out branch, or
Nonewhen detached. - diff
- Patch of
headagainst the merge base withbase. - diff_
stat --statsummary ofbase...head.- disable_
worktree_ config - Undo
enable_worktree_config. - enable_
worktree_ config - Enable
extensions.worktreeConfigif it is not already on. - fetch
- Fetch one branch from
remote, updating its remote-tracking ref. - git
- Run
git, failing on a non-zero exit status. - git_raw
- Run
gitincwdwithargs, returning the captured output regardless of exit status. - is_
clean - Is the working tree free of tracked modifications and untracked files?
- local_
exclude - Exclude a path from a worktree’s status without touching
.gitignore. - log_
oneline - One-line log of
base..head, oldest first. - merge_
no_ ff git merge --no-ffofbranchinto the currently checked-out branch.- push
- Push a branch to
remote. - push_
rewritten - Force-push a branch that has been rewritten, refusing to clobber work pushed since this side last looked.
- rebase_
branch_ in_ temp - Rebase a branch onto
onto, inside a throwaway worktree. - reset_
detached - Move an existing detached worktree to
rev, discarding local state. - rev_
exists - Does this ref resolve?
- rev_
parse - Resolve a revision to a full object id.
- set_
worktree_ hooks_ path - Point a single worktree at its own hooks directory.
- status_
porcelain git status --porcelain, for reporting what is dirty.- toplevel
- Absolute path to the top level of the working tree containing
path. - worktree_
add_ branch - Create a worktree at
pathwith a fresh branchbranchstarting atbase. - worktree_
add_ detached - Create a worktree at
pathwith a detached HEAD atrev. - worktree_
remove - Remove a worktree. Returns
Ok(false)when git refused (e.g. the path is already gone), so callers can keep folding the rest of a run.