Documentation
¶
Overview ¶
Package git provides Git operations for the gwq application.
Index ¶
- type Git
- func (g *Git) AddWorktree(path, branch string, createBranch bool) error
- func (g *Git) AddWorktreeFromBase(path, branch, baseBranch string) error
- func (g *Git) DeleteBranch(branch string, force bool) error
- func (g *Git) GetRecentCommits(path string, limit int) ([]models.CommitInfo, error)
- func (g *Git) GetRepositoryName() (string, error)
- func (g *Git) GetRepositoryPath() (string, error)
- func (g *Git) GetRepositoryURL() (string, error)
- func (g *Git) ListBranches(includeRemote bool) ([]models.Branch, error)
- func (g *Git) ListWorktrees() ([]models.Worktree, error)
- func (g *Git) PruneWorktrees() error
- func (g *Git) RemoveWorktree(path string, force bool) error
- func (g *Git) Run(args ...string) (string, error)
- func (g *Git) RunCommand(args ...string) (string, error)
- func (g *Git) RunWithContext(ctx context.Context, args ...string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Git ¶
type Git struct {
// contains filtered or unexported fields
}
Git provides Git command operations.
func NewFromCwd ¶
NewFromCwd creates a new Git instance using the current working directory.
func (*Git) AddWorktree ¶
AddWorktree creates a new worktree.
func (*Git) AddWorktreeFromBase ¶ added in v0.0.4
AddWorktreeFromBase creates a new worktree with a branch from a specific base branch.
func (*Git) DeleteBranch ¶
DeleteBranch deletes a branch.
func (*Git) GetRecentCommits ¶
GetRecentCommits returns recent commits for a specific path.
func (*Git) GetRepositoryName ¶
GetRepositoryName returns the name of the repository.
func (*Git) GetRepositoryPath ¶
GetRepositoryPath returns the root path of the git repository.
func (*Git) GetRepositoryURL ¶
GetRepositoryURL returns the remote origin URL of the repository.
func (*Git) ListBranches ¶
ListBranches returns a list of all branches.
func (*Git) ListWorktrees ¶
ListWorktrees returns a list of all worktrees in the repository.
func (*Git) PruneWorktrees ¶
PruneWorktrees removes worktree information for deleted directories.
func (*Git) RemoveWorktree ¶
RemoveWorktree removes a worktree.
func (*Git) Run ¶ added in v0.0.3
Run is an alias for RunCommand maintained for backward compatibility. New code should prefer using RunCommand for clarity.
func (*Git) RunCommand ¶
RunCommand executes a git command with the provided arguments and returns the output. This is the primary public interface for running arbitrary git commands. The command is executed in the Git instance's working directory if set. Returns the command output as a string, or an error if the command fails.
func (*Git) RunWithContext ¶ added in v0.0.3
RunWithContext executes a git command with context support for cancellation and timeout. The command will be terminated if the context is cancelled or times out. This is useful for implementing timeouts or graceful shutdowns. Returns the command output as a string, or an error if the command fails or is cancelled.