Skip to main content

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.

The create command saves the current state of your working directory, including staged changes, unstaged changes, and untracked files.

Syntax

git-snapshot [name]
git-snapshot create [name]

Parameters

  • name (optional): A descriptive name for the snapshot. If omitted, only the hash will be used as the identifier.

What gets saved

A snapshot captures three categories of changes:
  1. Staged files: Files added to the index with git add
  2. Unstaged files: Modified tracked files not yet staged
  3. Untracked files: New files not ignored by .gitignore

Examples

Create a named snapshot

git-snapshot my-feature
Output:
Snapshot created: my-feature.a1b2c3d4.snapshot

  Staged files:    2
  Unstaged files:  1
  Untracked files: 3

Restore with:
  git-snapshot restore my-feature

Create an unnamed snapshot

git-snapshot
Output:
Snapshot created: a1b2c3d4.snapshot

  Staged files:    0
  Unstaged files:  5
  Untracked files: 0

Restore with:
  git-snapshot restore a1b2c3d4

Create with explicit command

git-snapshot create experiment-1

Behavior

  • If there are no changes to save (no staged, unstaged, or untracked files), the command outputs “No changes to save” and exits without creating a snapshot
  • Each snapshot is stored with a unique 8-character hash generated from the timestamp and random data
  • Snapshots are stored in $XDG_DATA_HOME/git-snapshots (defaults to ~/.local/share/git-snapshots)
  • The snapshot includes metadata about the repository, branch, commit, and creation time
The create command is the default action when no command is specified. Running git-snapshot foo is equivalent to git-snapshot create foo.

Snapshot metadata

Each snapshot stores:
  • Repository remote URL (if configured)
  • Repository path
  • Current branch name
  • Current commit hash
  • Creation timestamp
  • List of staged, unstaged, and untracked files

Error handling

The command requires you to be in a git repository. If run outside a git repository, it will exit with an error:
Error: Not in a git repository

Build docs developers (and LLMs) love