Documentation
¶
Overview ¶
Package worktree orchestrates creating a new git worktree: resolving paths from config templates, branching from origin's default branch, copying env files, and installing dependencies.
Index ¶
- func Branch(cfg config.Config, name string) string
- func Dir(cfg config.Config, mainDir string) string
- func List(mainDir string, w io.Writer) error
- func New(cfg config.Config, mainDir, name, branch string, w io.Writer) (string, error)
- func Open(cfg config.Config, mainDir, name string, w io.Writer) error
- func Path(cfg config.Config, mainDir, name string) (string, error)
- func Remove(cfg config.Config, mainDir, name string, w io.Writer) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dir ¶
Dir resolves the base directory (parent of all worktrees for this repo) from cfg.WorktreeDir, substituting {repo} and resolving it relative to mainDir.
func List ¶
List prints every worktree registered against mainDir (the main checkout included) as a two-column, alignment-padded table: branch first, path second.
func New ¶
New creates a worktree named name (branch defaults to cfg.BranchPattern with name substituted if branch is empty), branching from origin's default branch. It copies configured env files, runs the install command unless disabled, and opens the editor unless disabled. Status messages are written to w. It returns the created worktree's path.
func Open ¶
Open opens the worktree named name in the configured editor — or, if name is empty, prompts the user to pick one via an interactive picker (the main checkout is offered as an option, labeled "(main)"). Status messages are written to w.
func Path ¶
Path returns the worktree path for name — or, if name is empty, prompts the user to pick one via an interactive picker (the main checkout is offered as an option, labeled "(main)"). It doesn't check the path exists.
Types ¶
This section is empty.