git

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package git provides utilities for reading git repository state (branch, commit, dirty status).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCommitsSince

func GetCommitsSince(sha string) (int, error)

GetCommitsSince returns the number of commits since a given SHA

func GetRootDir

func GetRootDir() (string, error)

GetRootDir returns the git repository root directory

func IsRepo

func IsRepo() bool

IsRepo checks if we're in a git repository

Types

type DiffStats

type DiffStats struct {
	FilesChanged int
	Additions    int
	Deletions    int
}

DiffStats summarizes git diff statistics

func GetDiffStatsSince

func GetDiffStatsSince(sha string) (*DiffStats, error)

GetDiffStatsSince returns diff statistics since a given SHA

type FileChange

type FileChange struct {
	Path      string
	Additions int
	Deletions int
	IsNew     bool
}

FileChange represents changes to a file

func GetChangedFilesSince

func GetChangedFilesSince(sha string) ([]FileChange, error)

GetChangedFilesSince returns changed files since a given SHA

type State

type State struct {
	CommitSHA  string
	Branch     string
	IsClean    bool
	Modified   int
	Untracked  int
	DirtyFiles int
}

State represents the current git state

func GetState

func GetState() (*State, error)

GetState returns the current git state

Jump to

Keyboard shortcuts

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