Skip to main content

Module git

Module git 

Source

Functions§

detect_mode
Detect a git repository during clone_repo and resolve its base revision.
diff_files
Compute the changed files (with old/new contents) between the sandbox branch and its parent, for the diff view. Runs against the original repo (repo_path), which shares refs with the sandbox worktree.
git_amend_all
Stage all changes and amend the current commit. When message is Some, the commit message is replaced; when None the existing message is kept (--no-edit).
git_branch_top_is_empty
Check if the top commit on a branch has no file changes vs its parent.
git_commit_all
Stage all changes and create a commit.
git_configured_user
Read the configured git user from a repo directory. Returns Some((name, email)) if both are configured, None otherwise.
git_delete_branch
Delete a branch.
git_has_commits_on_branch
Check if a branch has commits beyond its fork point from HEAD.
git_merge_branch
Merge a branch into the current branch.
git_worktree_add
Create a git worktree with a new branch. If the branch already exists (e.g. from a previous session), prunes stale worktrees and checks out the existing branch instead of creating a new one. Detects the repo’s configured user and configures the worktree identity.
git_worktree_remove
Remove a git worktree.
run_git
Run a git command in the given directory, returning stdout on success.
squash_from
Squash the changes from from_branch into the sandbox by merging, then delete the branch (best-effort).