git-checkpoint
A Git-based workspace state management system that provides efficient codebase state tracking and restoration capabilities.
How It Works
git-checkpoint uses Git under the hood but operates completely independently from your workspace's version control:
- Creates a separate "shadow" Git repository in a temporary directory
- Your workspace files are copied to this shadow repository for tracking
- All Git operations happen in the shadow repository, never touching your actual workspace's Git state
- When restoring checkpoints, files are copied back from the shadow repository
- Your workspace's Git repository (if any) remains completely untouched
Features
- Shadow Git repository management for non-intrusive state tracking
- Workspace state tracking with commit and restore functionality
- Efficient diff generation between states
- Smart handling of large files (LFS)
- Nested Git repository support
- Configurable file exclusion patterns
Installation
# Using poetry (recommended)
poetry add git-checkpoint
# Using pip
pip install git-checkpoint
Quick Start
from git_checkpoint import CheckpointTracker
# Initialize tracker (creates shadow repository in temp directory)
tracker = CheckpointTracker.create(
task_id="my_task",
workspace_path="/path/to/workspace"
)
# Create a checkpoint (copies current workspace state to shadow repo)
commit_hash = tracker.commit()
# Get changes between checkpoints
diffs = tracker.get_diff_set(
lhs_hash="previous_hash",
rhs_hash="current_hash"
)
# Restore to a previous state (copies files back from shadow repo)
tracker.reset_head("previous_hash")
# Clean up shadow repository when done
tracker.cleanup()
Configuration
Create a .checkpointrc file in your workspace:
enabled: true
storage_path: ".checkpoints"
ignore_patterns:
- "*.pyc"
- "__pycache__"
- "node_modules"
- ".git"
API Reference
CheckpointTracker
Constructor
def __init__(self, task_id: str, workspace_path: str)
task_id: Unique identifier for the checkpoint sessionworkspace_path: Path to the workspace to track
Methods
create
@classmethod
def create(cls, task_id: str, workspace_path: str) -> "CheckpointTracker"
Creates and initializes a new checkpoint tracker.
commit
def commit(self) -> Optional[str]
Creates a new checkpoint of the current workspace state. Returns the commit hash.
reset_head
def reset_head(self, commit_hash: str) -> None
Restores the workspace to the state of the specified commit.
get_diff_set
def get_diff_set(
self,
lhs_hash: Optional[str],
rhs_hash: Optional[str]
) -> List[DiffInfo]
Returns a list of file differences between two commits.
Development
# Install dependencies
poetry install
# Run tests
poetry run pytest tests/ -v
# Run tests with coverage
poetry run pytest tests/ -v --cov=git_checkpoint
Error Handling
The package uses custom exceptions for common error cases:
WorkspaceError: Invalid workspace configurationGitError: Git operation failuresConfigError: Configuration parsing issues
Best Practices
- Always validate workspace paths before initialization
- Use meaningful task IDs for better organization
- Handle large files appropriately using LFS
- Regularly clean up old checkpoints to manage storage
Attribution
Thank you to Cline(particularly the repo checkpointing concept) for inspiring this package!
Metadata
Release files for git-checkpoint 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| git_checkpoint-0.1.3.tar.gz | 9.0 kB | Without provenance | Details for git_checkpoint-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| git_checkpoint-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for git_checkpoint-0.1.3-py3-none-any.whl |
Total release size: 18.5 kB
Release files / git_checkpoint-0.1.3.tar.gz
| Download URL | git_checkpoint-0.1.3.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dcb2a3c8cb24e3992ba355a93d5bb954dfae598d74dde8932c497e0e88624b68
|
|
BLAKE2b-256 checksum How to use checksums |
5a24ed2dc3ead2ebda437fc4ef89ffc0ebb13689f123a4adad613541e04a86cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.1 CPython/3.11.6 Darwin/24.1.0
|
Release files / git_checkpoint-0.1.3-py3-none-any.whl
| Download URL | git_checkpoint-0.1.3-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0f378a613720019953e68b55b18758df78c8111fdf32c7e41a848fee277c5cd6
|
|
BLAKE2b-256 checksum How to use checksums |
ce50c6f78667cc85f41925d68fa53cf2cbfe7fa6a0c3e25eefc363afc4fc169d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.1 CPython/3.11.6 Darwin/24.1.0
|
Security for git-checkpoint 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.