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§
- acquire_
worktree_ config - Take a reference on
extensions.worktreeConfigbeing on forrepo. - 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_
ff_ only - Fast-forward
branchinto the currently checked-out branch, refusing to create a merge commit. - merge_
no_ ff git merge --no-ffofbranchinto the currently checked-out branch.- merge_
squash git merge --squashofbranch, followed by a commit undermessage.- 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. - release_
worktree_ config - Release a reference taken by
acquire_worktree_config. - remove_
worktree_ from_ linked - Unregister a linked worktree whose directory is about to be deleted by
hand, so the path can be
worktree add-ed again. - 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.- sync_
to_ head - Bring an attached worktree’s index and files in line with wherever its branch now points.
- 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_
prune - Drop registrations for worktrees whose directory is already gone.
- 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.