Versions in this module Expand all Collapse all v0 v0.2.0 Oct 14, 2026 v0.1.1 Oct 14, 2026 v0.1.0 Oct 14, 2026 Changes in this version + const LFSFetchExclude + const RewrittenPrefix + const SourceRemote + var ErrBusy = errors.New("git is busy in it") + var ErrHasWorktrees = errors.New("it has linked worktrees") + var ErrLocked = errors.New("repo locked") + var ErrNoBackup = errors.New("no backup found") + var ErrNotAMirror = errors.New("it isn't a mirror (remote.origin.mirror is unset)") + var ErrPartialSource = errors.New(...) + var ErrRepoGone = errors.New("the repo is gone") + var ErrRepoInUse = errors.New("another gitten command is using the repo") + func AddWorktree(ctx context.Context, source, dest, branch, base string, opts CloneOptions) error + func AheadBehind(ctx context.Context, repoPath, ref string) (ahead, behind int, err error) + func ApplyBackup(ctx context.Context, repoPath string, b BackupInfo) error + func ArchiveClone(ctx context.Context, repoPath, dir, name string) (string, error) + func BatchEnv() []string + func BranchExists(ctx context.Context, repoPath, branch string) bool + func CheckIdle(ctx context.Context, repoPath string, operations bool) error + func Clone(ctx context.Context, url, destPath string, opts CloneOptions) error + func CloneFromSource(ctx context.Context, source, dest, upstream, branch, base string, shared bool, ...) error + func Commit(ctx context.Context, repoPath, message string, addUntracked bool) (committed bool, err error) + func CopyID(ctx context.Context, repoPath string) (string, error) + func DefaultBase(ctx context.Context, source string) string + func DeleteArchive(path string) error + func FastForward(ctx context.Context, repoPath string) (updated bool, skipped string, err error) + func Fetch(ctx context.Context, repoPath, sshKeyPath string) error + func Git(ctx context.Context, repoPath string, args ...string) (string, error) + func GitExitCode(ctx context.Context, repoPath string, args ...string) int + func GitOutput(ctx context.Context, repoPath string, args ...string) ([]byte, error) + func GitWithSSHKey(ctx context.Context, repoPath, sshKeyPath string, args ...string) (string, error) + func HasGitDir(path string) bool + func IsBareRepo(ctx context.Context, repoPath string) bool + func IsLocked(ctx context.Context, repoPath string) (bool, string) + func IsPartial(ctx context.Context, path string) bool + func IsStaging(name string) bool + func LinkedWorktrees(ctx context.Context, repoPath string) ([]string, error) + func LocalConfig(ctx context.Context, repoPath string) (map[string]string, error) + func LockRepo(ctx context.Context, repoPath string, exclusive bool, wait time.Duration) (release func(), err error) + func Mirror(ctx context.Context, url, path string, opts MirrorOptions) (created bool, err error) + func ParseRemoteURL(ctx context.Context, repoPath string) (*repourl.Identity, error) + func Pull(ctx context.Context, repoPath, sshKeyPath string, ffOnly, rebase bool) (string, error) + func Push(ctx context.Context, repoPath, sshKeyPath string, setUpstream bool) (string, error) + func PushOffsite(ctx context.Context, repoPath string, latest *Latest, o Offsite, ...) (OffsiteRecord, OffsitePlan, error) + func ReadCopyID(ctx context.Context, repoPath string) string + func RefreshFromSource(ctx context.Context, copyPath, source string) error + func RemoveClone(ctx context.Context, repoPath, archiveDir, name string, opts RemoveOptions) (string, error) + func RemoveWorktree(ctx context.Context, source, path, archiveDir, name string, opts RemoveOptions) (string, error) + func RepointSource(ctx context.Context, copyPath, from, to string) error + func ResolveBase(ctx context.Context, repo, base string) (string, error) + func RestoreArchive(ctx context.Context, path, dest, base string) error + func RestoreBackupInto(ctx context.Context, repoPath string, b BackupInfo, into string) error + func SetLocalConfig(ctx context.Context, repoPath, key, value string) error + func SetOriginURL(ctx context.Context, repoPath, url string) error + func Source(ctx context.Context, path string) string + func Submodules(ctx context.Context, repoPath string) ([]string, error) + func TestSign(ctx context.Context, settings map[string]string) error + func UnsetLocalConfig(ctx context.Context, repoPath, key string) error + func Upstream(ctx context.Context, repoPath string) string + func WorktreeAdd(ctx context.Context, repoPath, worktreePath, branch, baseRef string) error + func WorktreeMove(ctx context.Context, repoPath, from, to string) error + func WorktreePrune(ctx context.Context, repoPath string) error + func WorktreeRemove(ctx context.Context, repoPath, worktreePath string, force bool) error + func WorktreeRepair(ctx context.Context, repoPath string) error + type ArchiveMeta struct + Base string + Branch string + Bundle string + Clone string + Complete bool + Created time.Time + Head string + LFS string + Remotes map[string]string + Repo string + Restore string + Source string + Submodules map[string]string + Work string + func ReadArchive(path string) (ArchiveMeta, string, error) + type BackupConfig struct + Limits SnapshotLimits + Now func() time.Time + PatchDir string + Retention Retention + Strategy string + func NewBackupConfig(opts ...BackupOption) BackupConfig + type BackupInfo struct + Commit string + CopyID string + ID string + Meta *BackupMeta + PatchDir string + Ref string + Submodules map[string]SubmoduleBackup + func FindBackup(ctx context.Context, repoPath, patchRoot, id string) (BackupInfo, error) + func ListBackups(ctx context.Context, repoPath, patchRoot string) ([]BackupInfo, error) + func (b BackupInfo) RestoreCommands() []string + func (b BackupInfo) Snapshot() string + func (b BackupInfo) Submodule(ctx context.Context, repoPath, path string) (sub BackupInfo, ok bool, err error) + type BackupMeta struct + Base string + Branch string + CopyID string + Created time.Time + ID string + IndexUnmerged bool + Path string + Skipped []SkippedFile + Snapshot string + Submodules map[string]SubmoduleBackup + type BackupOption func(*BackupConfig) + func WithClock(now func() time.Time) BackupOption + func WithIncludeUntracked(b bool) BackupOption + func WithPatchDir(d string) BackupOption + func WithRetention(r Retention) BackupOption + func WithStrategy(s string) BackupOption + func WithUntrackedLimits(maxFile, maxTotal int64) BackupOption + type BackupOutcome int + const BackupClean + const BackupSaved + const BackupUnchanged + func (o BackupOutcome) String() string + type BackupResult struct + CopyID string + ID string + IndexUnmerged bool + Outcome BackupOutcome + PatchDir string + Ref string + Skipped []SkippedFile + Snapshot string + Submodules map[string]*BackupResult + func Backup(ctx context.Context, repoPath string, cfg BackupConfig) (*BackupResult, error) + func (r *BackupResult) Dirty() bool + type CloneOptions struct + Depth int + Filter string + SSHKey string + type GitDirs struct + CommonDir string + GitDir string + func ResolveGitDirs(ctx context.Context, repoPath string) GitDirs + type Latest struct + BackupID string + Snapshot string + type MirrorOptions struct + KeepRewritten time.Duration + LFS bool + Now func() time.Time + SSHKey string + type Offsite struct + Branch string + Bundle string + Keep time.Duration + Namespace string + Now func() time.Time + Remote string + SSHKey string + Unpushed string + WIP string + type OffsitePlan struct + Bundle map[string]string + Next OffsiteRecord + Push []string + func PlanOffsite(ctx context.Context, repoPath string, latest *Latest, o Offsite, ...) (OffsitePlan, error) + func (p OffsitePlan) Empty() bool + type OffsiteRecord struct + Branch string + Bundled map[string]string + Heads map[string]string + Namespace string + Remote string + WIP []string + func (r OffsiteRecord) Empty() bool + type RemoveOptions struct + Base string + Discard bool + KeepHistory bool + Repo string + type RepoStatus struct + CurrentBranch string + HasStaged bool + HasUnstaged bool + HasUntracked bool + InCherryPick bool + InMerge bool + InRebase bool + func GetStatus(ctx context.Context, repoPath string) (*RepoStatus, error) + func (rs *RepoStatus) StatusString() string + type Retention struct + KeepAll time.Duration + KeepDaily time.Duration + Max int + type Shape struct + SkipLFS bool + Sparse []string + Submodules bool + type SkippedFile struct + Path string + Reason string + type Snapshot struct + Base string + Commit string + Index string + IndexUnmerged bool + Skipped []SkippedFile + Untracked string + func TakeSnapshot(ctx context.Context, repoPath string, limits SnapshotLimits) (Snapshot, error) + type SnapshotLimits struct + MaxFileBytes int64 + MaxTotalBytes int64 + Untracked bool + type SubmoduleBackup struct + CopyID string + ID string + type SubmoduleError struct + Err error + Path string + func (e *SubmoduleError) Error() string + func (e *SubmoduleError) Unwrap() error + type UniqueWork struct + Changed int + DetachedCommits int + InProgress string + OtherRefCommits int + Stashes int + Submodules map[string]UniqueWork + UnpushedCommits int + Untracked int + func InspectUniqueWork(ctx context.Context, repoPath string) (UniqueWork, error) + func (u UniqueWork) LostWithClone() bool + func (u UniqueWork) LostWithWorktree() bool + func (u UniqueWork) String() string + type WorktreeInfo struct + Bare bool + Branch string + Detached bool + Head string + Path string + func WorktreeList(ctx context.Context, repoPath string) ([]WorktreeInfo, error)