Documentation
¶
Overview ¶
Package gitutil holds helpers for interacting with git and with the Claude Code worktree layout (.claude/worktrees/<name>).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddWorktree ¶
AddWorktree creates a new linked worktree at `path` on a freshly-created branch `branch`, via `git worktree add -b <branch> <path>`. On success the command is silent — git's progress chatter ("Preparing worktree…", "HEAD is now at…") is captured and discarded. On failure the captured output is written verbatim to the process stderr so the user sees git's own error message.
func RepoRoot ¶
RepoRoot runs `git rev-parse --show-toplevel` and returns the resulting path with its trailing newline trimmed. Git's stderr is passed through to the process stderr so the caller's user sees `fatal: not a git repository` and similar messages.
If stripClaudeWorktree is true and the toplevel sits inside a Claude Code worktree (`.claude/worktrees/<name>`), the enclosing repository root is returned instead.
Types ¶
type Commit ¶
Commit holds the bits of a git commit we display.
func LastCommit ¶
LastCommit returns the HEAD commit of the repository at repoPath.
type Worktree ¶
Worktree is one entry from `git worktree list`.
func ListWorktrees ¶
ListWorktrees parses `git worktree list --porcelain` and returns all registered worktrees (including the main one).