git

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package git provides Git operations for branch discovery and management.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultBranches added in v1.0.3

func DefaultBranches() []string

DefaultBranches returns the fallback branch list used when none can be fetched.

func FetchBranches

func FetchBranches(ctx context.Context) ([]string, error)

FetchBranches retrieves all branches from the git repository. Returns both local and remote-tracking branches, with "origin/" prefix stripped. Falls back to default branches on error.

func GetCurrentBranch

func GetCurrentBranch(ctx context.Context) string

GetCurrentBranch returns the currently checked out branch. Returns empty string if unable to determine (e.g., detached HEAD).

func GetDefaultBranch

func GetDefaultBranch(ctx context.Context) string

GetDefaultBranch attempts to determine the repository's default branch. Returns empty string if unable to determine.

Types

type CommandRunner

type CommandRunner interface {
	RunCommand(ctx context.Context, args ...string) ([]byte, error)
}

CommandRunner executes git commands and returns their output.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL