Documentation
¶
Overview ¶
Package git wraps the git plumbing commands wt shells out to.
Index ¶
- func BranchDelete(mainDir, branch string) error
- func DefaultBranch(mainDir string) string
- func Fetch(mainDir string) error
- func MainDir() (string, error)
- func RefExists(mainDir, ref string) bool
- func WorktreeAdd(mainDir, dir, branch, baseRef string) error
- func WorktreePrune(mainDir string) error
- func WorktreeRemove(mainDir, dir string) error
- type Worktree
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BranchDelete ¶
BranchDelete runs `git branch -d <branch>` in mainDir.
func DefaultBranch ¶
DefaultBranch returns the short name of origin's default branch (e.g. "main"), resolved from the local origin/HEAD symref. Empty if unset.
func MainDir ¶
MainDir resolves the main checkout root, even when the current directory is inside a linked worktree. It shells out to `git rev-parse --git-common-dir` and returns the parent of that dir.
func WorktreeAdd ¶
WorktreeAdd runs `git worktree add <dir> -b <branch> <baseRef>` in mainDir.
func WorktreePrune ¶
WorktreePrune runs `git worktree prune` in mainDir.
func WorktreeRemove ¶
WorktreeRemove runs `git worktree remove <dir>` in mainDir.
Types ¶
type Worktree ¶
Worktree is one entry from `git worktree list`: its checkout path and the branch checked out there ("(detached)" if none).
func WorktreeList ¶
WorktreeList returns all worktrees registered against mainDir (the main checkout included), parsed from `git worktree list --porcelain`.