Skip to main content

Module git

Module git 

Source
Expand description

Git operations.

Validates git repositories, lists branches, creates and removes worktrees, and derives worktree directory names from project and branch names.

Structs§

WorktreeCreation
Result of creating a worktree, including whether the branch was newly created.

Functions§

assume_unchanged
Marks a file as assume-unchanged in git’s index.
check_uncommitted_specs
Checks for uncommitted changes in spec directories or files.
create_worktree
Creates a git worktree for branch.
current_branch
Returns the short name of the current branch (e.g., “main”, “feat/add-auth”).
default_branch
Returns the name of the default branch (usually “main” or “master”).
delete_branch
Deletes a branch.
exclude_from_git
Excludes a file from git tracking by adding it to .git/info/exclude.
list_branches
Lists all branches (local and remote), deduplicated, sorted, with remote prefixes stripped.
merge_branch
Merges the specified branch into the current branch.
project_name
Returns the name of the project (directory name of the git repository).
prune_worktrees
Prunes stale worktree registrations from the git worktree list.
remove_worktree
Removes the worktree at the given path.
uncommitted_files
Returns the list of files with uncommitted changes in worktree_root.
validate_repo
Validates that the given path is inside a git repository.
worktree_dir_name
Derives a worktree directory name from project and branch names.