gitcp

package
v0.9.1 Latest Latest
Warning

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

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

Documentation

Overview

Package gitcp takes git snapshots of a working tree before each agent turn, so changes can be shown (/diff) and rolled back (/undo) without touching the user's branch, index or stash.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diff

func Diff(ctx context.Context, dir, from string) (string, error)

Diff returns a patch from `from` (a commit, or "HEAD") to the current working tree, including new untracked files.

func Restore

func Restore(ctx context.Context, dir, commit string) error

Restore puts the working tree back to the snapshot: changed and deleted files are restored, files created since are removed. The index and branch are left alone.

func Root

func Root(ctx context.Context, dir string) string

Root returns the repository root containing dir, or "" if dir is not in a repo.

func Snapshot

func Snapshot(ctx context.Context, dir string) (string, error)

Snapshot records the current working tree and returns a commit id.

Types

type Git added in v0.6.0

type Git struct{}

Git implements checkpoints with git. The zero value is ready to use.

func (Git) Diff added in v0.6.0

func (Git) Diff(ctx context.Context, dir, from string) (string, error)

func (Git) Restore added in v0.6.0

func (Git) Restore(ctx context.Context, dir, id string) error

func (Git) Snapshot added in v0.6.0

func (Git) Snapshot(ctx context.Context, dir string) (string, error)

Jump to

Keyboard shortcuts

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