Snapshots are stored outside your Git repository in a XDG-compliant directory. This keeps them separate from your repository history and allows them to survive even if you delete the repository.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/mubshrx/git-snapshot/llms.txt
Use this file to discover all available pages before exploring further.
Storage location
All snapshots are stored in:$XDG_DATA_HOME, snapshots will use that:
Why external storage?
Storing snapshots outside.git/ has several benefits:
- Repository independence - Snapshots survive repository deletion
- No Git interference - Won’t be included in commits, pushes, or Git operations
- Centralized management - All snapshots in one place for backup
- No .gitignore needed - Completely separate from your working directory
File format
Each snapshot is a gzipped tarball with a specific naming convention:my-feature.a1b2c3d4.snapshot(with custom name)a1b2c3d4.snapshot(hash only)
File structure
Inside each.snapshot file:
staged/, unstaged/, untracked/) preserves the complete file path structure from your repository.
Example snapshot contents
Metadata structure
Themetadata.json file contains all information about the snapshot:
Metadata fields
| Field | Description |
|---|---|
name | Custom name provided (empty string if none) |
hash | 8-character unique identifier |
repo_remote | Git remote URL (git config --get remote.origin.url) |
repo_path | Absolute path to repository root |
branch | Branch name when snapshot was created |
commit | Full commit SHA when snapshot was created |
created_at | ISO 8601 timestamp (UTC) |
staged_files | Array of staged file paths |
unstaged_files | Array of unstaged file paths |
untracked_files | Array of untracked file paths |
Repository matching
When you list or restore snapshots, git-snapshot determines which snapshots belong to the current repository by:- Matching remote URL (if both repos have one)
- Matching repository path (fallback if no remote)
/home/daytona/workspace/source/src/git-snapshot:54-69:
If you move or clone a repository, snapshots will only match if the remote URL is the same. Path-based matching only works for the exact original location.
Hash generation
The 8-character hash is generated from the current timestamp and random data:- Uniqueness - Extremely unlikely to have collisions
- Short identifiers - Easy to type and reference
- No sequential patterns - Hashes are effectively random
Extracting snapshot data
You can manually inspect snapshot contents:View metadata only
Extract full snapshot
View specific file content
Storage considerations
Disk space
Because snapshots store full file contents (not diffs), they can consume significant disk space if you:- Create many snapshots
- Have large binary files
- Snapshot large codebases frequently
Backup
Since snapshots live in~/.local/share/git-snapshots/, you can:
- Back up the entire directory independently
- Copy snapshots between machines
- Version control the directory itself (if desired)
Security
Snapshots are stored as plain files in your home directory:- Permissions - Same as your user’s normal file permissions
- No encryption - Contents are not encrypted
- No sensitive files filter - All files matching the criteria are saved
Be cautious about snapshotting files containing secrets. Snapshots respect
.gitignore, but if you’ve tracked sensitive files, they’ll be included in snapshots.