On this page
API reference for the git package — helpers for managing the git index alongside saferm archive and restore operations on tracked files.
#internal/git
#internal/git
Package git provides helpers for managing the git index alongside saferm's archive/restore operations.
#IsInGitRepo
func IsInGitRepo(dir string) boolIsInGitRepo returns true if dir is inside a git working tree.
#IsGitTracked
func IsGitTracked(path string) boolIsGitTracked returns true if the file at path is tracked by git (i.e., known to the index). The path must be absolute or relative to the current working directory; the command runs from the file's parent directory.
#GitRmCached
func GitRmCached(path string, recursive bool) errorGitRmCached stages the removal of path in the git index without touching the working tree (the file is already archived). When recursive is true, -r is added for directory removal.
#GitAdd
func GitAdd(path string) errorGitAdd stages a file in the git index. The command runs from the file's parent directory.