Skip to main content

Module git

Module git 

Source

Functions§

check_git_available
Check that git is available.
default_branch
Detect the default branch via origin/HEAD, falling back to main then master.
delete_branch
Delete a local branch with git branch -d (safe delete).
fetch
Run git fetch --quiet.
is_branch_merged
Check if a branch is merged into another branch.
local_branch_exists
Check if a local branch exists.
remote_branch_exists
Check if a remote tracking branch exists (origin/).
repo_root
Resolve the main repository root (the common dir for worktrees).
toplevel
Resolve the toplevel of the current working tree (the checkout root). For the main repo this is the repo root; for a worktree it’s the worktree directory.
worktree_add
Add a worktree.
worktree_add_new_branch
Add a worktree with a new branch.
worktree_list
List worktrees. Returns list of worktree paths.
worktree_remove
Remove a worktree.
worktree_remove_force
Force-remove a worktree (allows dirty/locked worktrees).