Skip to main content

Module worktree

Module worktree 

Source

Functions§

create_worktree
Create a git worktree at ~/.zag/worktrees/<sanitized-repo-path>/<name> using detached HEAD. Returns the path to the new worktree directory.
generate_name
Generate a random worktree name like zag-a1b2c3d4.
git_repo_root
Get the git repository root from a given directory (or current directory).
has_changes
Check if a worktree has any uncommitted changes (staged, unstaged, or untracked).
has_unpushed_commits
Check if a worktree has commits not present on any remote-tracking branch.
remove_worktree
Remove a git worktree at the given path.
worktree_base_dir
Compute the base directory for worktrees: ~/.zag/worktrees/<sanitized-repo-path>/.