git

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplySelectedChangesToFile

func ApplySelectedChangesToFile(filePath string, repoRoot string, diffText string, selectedStart, selectedEnd int) (string, string, error)

ApplySelectedChangesToFile returns file content with only selected changes applied It preserves existing staged changes and applies new selections on top

func CalculateGitHash

func CalculateGitHash(repoPath, filePath string) (string, error)

CalculateGitHash calculates the Git-style hash for a file.

func Commit

func Commit(message string, repoRoot string) error

func CommitAmend

func CommitAmend(message string, repoRoot string) error

func FindGitRoot

func FindGitRoot(startPath string) (string, error)

FindGitRoot searches for the .git directory by traversing up from the current directory

func GetChangedFiles

func GetChangedFiles(repoPath string) ([]FileInfo, []FileInfo, []FileInfo, error)

func GetFileContentFromHEAD

func GetFileContentFromHEAD(filePath string, repoRoot string) ([]byte, error)

GetFileContentFromHEAD returns file content at HEAD

func GetFileContentFromIndex

func GetFileContentFromIndex(filePath string, repoRoot string) ([]byte, error)

GetFileContentFromIndex returns file content from git index (staging area)

func GetFileDiff

func GetFileDiff(filePath string, repoRoot string) (string, error)

func GetFileDiffWithOptions

func GetFileDiffWithOptions(filePath string, repoRoot string, ignoreWhitespace bool) (string, error)

func GetStagedDiff

func GetStagedDiff(filePath string, repoRoot string) (string, error)

func GetStagedDiffWithOptions

func GetStagedDiffWithOptions(filePath string, repoRoot string, ignoreWhitespace bool) (string, error)

func RevertSelectedChangesFromStaged

func RevertSelectedChangesFromStaged(filePath string, repoRoot string, stagedDiffText string, selectedStart, selectedEnd int) (string, error)

RevertSelectedChangesFromStaged returns file content with selected changes reverted from staging It takes the staged diff and reverts only the selected lines back to HEAD state

Types

type FileInfo

type FileInfo struct {
	Path         string
	ChangeStatus string // "added", "deleted", "modified", "untracked"
}

FileInfo represents a file with its status

Jump to

Keyboard shortcuts

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