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.
How is this different from git stash?
How is this different from git stash?
git-snapshot and git stash serve similar purposes but with key differences:Persistence:
Use git stash when: you need quick, temporary storage during workflow interruptions
- Snapshots are stored as files in
~/.local/share/git-snapshotsand persist indefinitely - Stashes are stored in the git repository and can be lost if the repository is deleted
- Snapshots support custom names for easy identification:
git-snapshot my-feature - Stashes require remembering stash indices or using less intuitive naming
- Snapshots automatically track which repository they belong to
- Stashes are repository-specific but don’t prevent accidental application
- Snapshots support restoring only staged, unstaged, or untracked files separately
- Stashes restore everything at once
Use git stash when: you need quick, temporary storage during workflow interruptions
Can I use snapshots across different repositories?
Can I use snapshots across different repositories?
No, snapshots are repository-specific and cannot be restored across different repositories.Why this restriction exists:Workaround:To view snapshots from all repositories:
- Snapshots contain file paths relative to the repository root
- Different repositories have different structures and histories
- Preventing cross-repository restores avoids conflicts and data corruption
- Remote URL (primary): If both the snapshot and current repository have a remote origin, they must match
- Repository path (fallback): The absolute path to the repository root
What happens to snapshots when I delete a repository?
What happens to snapshots when I delete a repository?
Snapshots persist independently of their source repository.After deleting a repository:
- Snapshot files remain in
~/.local/share/git-snapshots - They continue to occupy disk space
- You cannot restore them to a new repository (even with the same name)
-
View all snapshots:
-
Delete specific snapshots:
-
Or manually clean the snapshots directory:
Are snapshots affected by commits?
Are snapshots affected by commits?
No, snapshots are completely independent of git commits and branch changes.What snapshots capture:The snapshot preserves your work exactly as it was, independent of git history.
- Staged changes (files in the index)
- Unstaged changes (modified tracked files)
- Untracked files (new files not yet tracked by git)
- Metadata: branch name, commit hash, timestamp
- Snapshots store the full file contents at the time of creation
- They remain unchanged regardless of future commits
- You can still restore the snapshot to see the exact state from when it was created
Can I restore only part of a snapshot?
Can I restore only part of a snapshot?
Yes, git-snapshot supports selective restoration using command-line flags.Available options:Default behavior:Without flags, all three categories are restored together.Use case:This is useful when you want to:
--staged-only- Restore only staged changes--unstaged-only- Restore only unstaged changes--untracked-only- Restore only untracked files
- Review staged changes without affecting your working directory
- Recover untracked files without overwriting current work
- Restore unstaged modifications while keeping your index clean
What happens to my current changes when I restore a snapshot?
What happens to my current changes when I restore a snapshot?
Restoring a snapshot will overwrite your current changes.Warning behavior:If you have uncommitted changes and restore a snapshot (with default or This lets you switch between different states safely.
--staged-only/--unstaged-only flags), git-snapshot will:- Detect uncommitted changes
- Display a warning:
Warning: You have uncommitted changes that will be overwritten! - Ask for confirmation:
Are you sure you want to continue? [y/N]
--staged-onlyor--unstaged-only: Current staged/unstaged changes are discarded- Default (no flags): All uncommitted changes are discarded
--untracked-only: Only adds untracked files, doesn’t affect existing changes
How do I find a snapshot if I forgot its name?
How do I find a snapshot if I forgot its name?
Use the This shows:Shows snapshots from all repositories, with repository information included.Inspect snapshot contents:Displays:
list command to see all snapshots for your repository.Basic listing:- Snapshot name and hash
- Branch it was created on
- Creation timestamp
- Snapshot metadata (hash, branch, commit, timestamp)
- List of staged files
- List of unstaged files
- List of untracked files
- Full name:
git-snapshot restore my-feature - Hash only:
git-snapshot restore a1b2c3d4 - Partial match: If multiple matches exist, you’ll be prompted to choose
Can I rename a snapshot after creating it?
Can I rename a snapshot after creating it?
Yes, use the Example:How it works:Solution: Choose a different name or delete the conflicting snapshot first.
rename command to change a snapshot’s name.Syntax:- The hash remains the same
- Only the name portion changes
- The snapshot file is recreated with updated metadata
- Cannot rename to a name that already exists
- If multiple snapshots match the old name, you must specify the hash
- Both old and new names are required
Where are snapshots stored and how much space do they use?
Where are snapshots stored and how much space do they use?
Snapshots are stored as compressed tar archives in your local filesystem.Storage location:Cleanup:
- Default:
~/.local/share/git-snapshots/ - Custom:
$XDG_DATA_HOME/git-snapshots/(if XDG_DATA_HOME is set)
- Extension:
.snapshot - Compression: gzip (tar.gz)
- Contents: Full file contents + metadata JSON
- With name:
name.hash.snapshot - Without name:
hash.snapshot - Hash: 8-character identifier (e.g.,
a1b2c3d4)
- Complete copies of all staged files
- Complete copies of all unstaged files
- Complete copies of all untracked files
- Small metadata file (JSON)
- Number and size of changed files
- Compression ratio (text files compress well)