git

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigPath = ".cyclestone/milestone.yml"

ConfigPath is the configurable path to the milestone YAML configuration.

Functions

func CheckoutBranch

func CheckoutBranch(branch string) (string, error)

CheckoutBranch performs a Git checkout for the specified branch.

func CheckoutOrCreateBranch

func CheckoutOrCreateBranch(branchName string) error

CheckoutOrCreateBranch performs a checkout or creation of a branch in the root directory.

func CheckoutOrCreateBranchInDir

func CheckoutOrCreateBranchInDir(dir, branchName string) error

CheckoutOrCreateBranchInDir checks out or creates a branch in a specific directory.

func Commit

func Commit(message string) (string, error)

Commit creates a new Git commit with the given message.

func CreateBranch

func CreateBranch(branch string) (string, error)

CreateBranch creates and switches to a new Git branch.

func GetCurrentBranch

func GetCurrentBranch() (string, error)

GetCurrentBranch returns the name of the active Git branch.

func GetDiff

func GetDiff() (string, error)

GetDiff retrieves the current git diff of unstaged and staged changes.

func GetLatestCommitHash

func GetLatestCommitHash() (string, error)

GetLatestCommitHash returns the short hash of the latest commit on the current branch.

func IsGitRepository

func IsGitRepository() bool

IsGitRepository checks if the current working directory is a git repository.

func IsGitWorktree

func IsGitWorktree(dir string) bool

IsGitWorktree reports whether dir is the top-level directory of a git worktree.

func VerifyBranchSnapshot

func VerifyBranchSnapshot(snapshots []RepoBranchSnapshot) (bool, string)

VerifyBranchSnapshot compares the current branches of all tracked repos against a saved snapshot. Returns true if matches, or false with violation descriptions.

Types

type RepoBranchSnapshot

type RepoBranchSnapshot struct {
	Label  string `json:"label"`
	Path   string `json:"path"`
	Branch string `json:"branch"`
}

RepoBranchSnapshot represents the captured branch state of a repository.

func CaptureBranchSnapshot

func CaptureBranchSnapshot() ([]RepoBranchSnapshot, error)

CaptureBranchSnapshot captures the current branch for all tracked repositories/submodules.

func CaptureBranchSnapshotForRepos

func CaptureBranchSnapshotForRepos(repos []RepoInfo) ([]RepoBranchSnapshot, error)

CaptureBranchSnapshotForRepos captures the current branch for the provided repositories/submodules.

type RepoInfo

type RepoInfo struct {
	Label string
	Path  string
}

RepoInfo represents a git repository worktree.

func GetTrackedRepos

func GetTrackedRepos() []RepoInfo

GetTrackedRepos returns all configured, worktree-discovered, and submodule git/non-git directories.

type RepoStatusSummary

type RepoStatusSummary struct {
	Label        string
	Path         string
	IsWorktree   bool
	Branch       string
	Detached     bool
	Unknown      bool
	Dirty        bool
	ChangedCount int
	StatusShort  string
}

RepoStatusSummary is a read-only snapshot of one tracked repository for preflight review and other non-mutating checks.

func SummarizeRepoStatus

func SummarizeRepoStatus(repo RepoInfo) RepoStatusSummary

SummarizeRepoStatus returns current branch and dirty-state information for a tracked repository without modifying branches, files, or index state.

func SummarizeTrackedRepoStatuses

func SummarizeTrackedRepoStatuses() []RepoStatusSummary

SummarizeTrackedRepoStatuses summarizes all repositories returned by GetTrackedRepos. It is intentionally bounded to tracked discovery results.

Jump to

Keyboard shortcuts

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