Documentation
¶
Index ¶
- func BranchExists(gitDir, branch string) bool
- func ConfigureFetchRefspec(gitDir, remoteURL string) error
- func CreateWorktree(gitDir, worktreePath, branch, baseBranch string) error
- func DeleteBranch(gitDir, branch string, force bool) error
- func FetchOrigin(gitDir string) error
- func FetchRemote(gitDir, remote string) error
- func FindGitDir(path string) (string, error)
- func GetBranchRefs(gitDir string) (local []string, remote []string, err error)
- func GetCurrentBranch(worktreePath string) (string, error)
- func GetDefaultBranch(gitDir string) (string, error)
- func GetRemoteURL(gitDir, remote string) (string, error)
- func GetRemoteURLFromWorktree(worktreePath string) (string, error)
- func GetRepoPath(gitDir string) string
- func HasBranchTracking(gitDir, branch string) (bool, error)
- func HasChanges(worktreePath string) (bool, error)
- func HasFetchRefspec(gitDir string) (bool, error)
- func HasStash(worktreePath string) (bool, error)
- func IsDetachedHEAD(worktreePath string) (bool, error)
- func IsGitRepo(path string) bool
- func IsIgnored(worktreePath, relativePath string) (bool, error)
- func IsMergeInProgress(worktreePath string) bool
- func IsMerged(gitDir, branch, targetBranch string) (bool, error)
- func IsRebaseInProgress(worktreePath string) bool
- func IsWorktreeDirty(worktreePath string) (bool, error)
- func ListAllBranches(gitDir string) ([]string, error)
- func ListBranches(gitDir string) ([]string, error)
- func ListLocalBranches(gitDir string) ([]string, error)
- func ListRemoteBranches(gitDir string) ([]string, error)
- func MergeInto(worktreePath, remote, upstream string) error
- func PopStash(worktreePath string) error
- func RebaseOnto(worktreePath, remote, upstream string) error
- func RemoveWorktree(gitDir, worktreePath string, force bool) error
- func SetBranchUpstream(gitDir, branch, remote string) error
- func StashAll(worktreePath string, message string) error
- type MergeConflictError
- type RebaseConflictError
- type StashConflictError
- type Worktree
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BranchExists ¶
BranchExists checks if a branch exists in the repository
func ConfigureFetchRefspec ¶
ConfigureFetchRefspec sets up remote.origin.url and fetch refspec in bare repo. This is idempotent - safe to call multiple times.
func CreateWorktree ¶
CreateWorktree creates a new worktree from a git directory
func DeleteBranch ¶
DeleteBranch deletes a branch from the repository
func FetchOrigin ¶ added in v1.6.0
FetchOrigin fetches from the origin remote to update remote-tracking refs.
func FetchRemote ¶
FetchRemote runs git fetch for the specified remote
func FindGitDir ¶
FindGitDir finds the .git directory from a path
func GetBranchRefs ¶
GetBranchRefs returns all local and remote branch names. Local branches are returned as-is (e.g., "main", "feature/foo"). Remote branches are returned with remote prefix (e.g., "origin/main").
func GetCurrentBranch ¶
GetCurrentBranch returns the current branch name, or empty string if detached HEAD
func GetDefaultBranch ¶
GetDefaultBranch returns the default branch name
func GetRemoteURL ¶
GetRemoteURL retrieves the remote URL for a given remote name. Returns empty string and nil error if remote is not configured.
func GetRemoteURLFromWorktree ¶
GetRemoteURLFromWorktree extracts remote URL from a worktree's git config.
func GetRepoPath ¶
GetRepoPath returns the repository working directory from a git dir
func HasBranchTracking ¶
HasBranchTracking checks if a branch has upstream tracking configured.
func HasChanges ¶
HasChanges checks if there are any changes that would be captured by stash This includes tracked modifications and untracked files (but not ignored files)
func HasFetchRefspec ¶
HasFetchRefspec checks if fetch refspec is already configured.
func IsDetachedHEAD ¶
IsDetachedHEAD checks if the worktree is on a detached HEAD
func IsMergeInProgress ¶
IsMergeInProgress checks if a merge is currently in progress in the worktree
func IsRebaseInProgress ¶
IsRebaseInProgress checks if a rebase is currently in progress in the worktree
func IsWorktreeDirty ¶
IsWorktreeDirty checks if the worktree has uncommitted changes
func ListAllBranches ¶
ListAllBranches lists all branches including current branch
func ListBranches ¶
ListBranches lists all local branches in the repository (excluding current branch)
func ListLocalBranches ¶
ListLocalBranches returns all local branch names.
func ListRemoteBranches ¶
ListRemoteBranches lists all remote branches in the repository
func MergeInto ¶
MergeInto runs git merge from the current worktree with the specified remote/branch
func PopStash ¶
PopStash pops the most recent stash Returns an error if there are conflicts or if the pop fails
func RebaseOnto ¶
RebaseOnto runs git rebase from the current worktree onto the specified remote/branch
func RemoveWorktree ¶
RemoveWorktree removes a worktree using a specific git directory
func SetBranchUpstream ¶
SetBranchUpstream configures a branch to track a remote. This is idempotent - safe to call multiple times.
Types ¶
type MergeConflictError ¶
type MergeConflictError struct {
Output string
}
MergeConflictError represents a merge that failed due to conflicts
func (*MergeConflictError) Error ¶
func (e *MergeConflictError) Error() string
type RebaseConflictError ¶
type RebaseConflictError struct {
Output string
}
RebaseConflictError represents a rebase that failed due to conflicts
func (*RebaseConflictError) Error ¶
func (e *RebaseConflictError) Error() string
type StashConflictError ¶
type StashConflictError struct {
Output string
}
StashConflictError represents a stash pop that failed due to conflicts
func (*StashConflictError) Error ¶
func (e *StashConflictError) Error() string
type Worktree ¶
Worktree represents a git worktree
func ListWorktrees ¶
ListWorktrees lists all worktrees for a git repository
func ListWorktreesDetailed ¶
ListWorktreesDetailed lists all worktrees with additional metadata