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.

Installation

Install git-snapshot using a one-line curl command, or clone and build from source.

Quick install

The fastest way to get started:
1

Run the install script

Execute the one-line installer:
curl -fsSL https://raw.githubusercontent.com/mhm13dev/git-snapshot/main/install.sh | bash
This installs git-snapshot to /usr/local/bin by default.
2

Verify installation

Check that git-snapshot is available:
git-snapshot help
You should see the help output with all available commands.
3

Create your first snapshot

Navigate to a Git repository and create a test snapshot:
cd your-repo
git-snapshot test
Output:
Snapshot created: test.a1b2c3d4.snapshot

  Staged files:    2
  Unstaged files:  1
  Untracked files: 0

Restore with:
  git-snapshot restore test

Custom installation directory

If you want to install to a different directory (e.g., ~/.local/bin):
1

Create the directory if needed

mkdir -p ~/.local/bin
2

Run installer with custom path

curl -fsSL https://raw.githubusercontent.com/mhm13dev/git-snapshot/main/install.sh | bash -s -- ~/.local/bin
3

Add to PATH if needed

If ~/.local/bin is not in your PATH, add it:For bash:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
For zsh:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
The installer will automatically detect if the install directory is not in your PATH and provide instructions.

Install from source

For development or if you prefer building locally:
1

Clone the repository

git clone https://github.com/mhm13dev/git-snapshot.git
cd git-snapshot
2

Run the local installer

./install.sh
The installer will detect the local source and install from there instead of downloading.
3

Verify installation

git-snapshot --help

Requirements

git-snapshot is a Bash script with minimal dependencies:
  • Bash (version 4.0 or later)
  • Git (any recent version)
  • curl or wget (for installation only)
  • tar (for creating and extracting snapshots)
  • jq (optional, for better JSON handling)
Most Unix-like systems (Linux, macOS) have these tools pre-installed.

Updating git-snapshot

To update to the latest version, simply re-run the installer:
curl -fsSL https://raw.githubusercontent.com/mhm13dev/git-snapshot/main/install.sh | bash
The installer will detect the existing installation and prompt you to overwrite:
git-snapshot is already installed at /usr/local/bin/git-snapshot
Overwrite? [y/N] y

Uninstallation

To remove git-snapshot:
# Remove the executable
sudo rm /usr/local/bin/git-snapshot

# Optionally, remove all snapshots
rm -rf ~/.local/share/git-snapshots
Removing ~/.local/share/git-snapshots will delete all your saved snapshots permanently. Make sure you don’t need them before removing this directory.

Troubleshooting

Permission denied during installation

If you see permission errors:
Need sudo to write to /usr/local/bin
The installer will automatically use sudo. Enter your password when prompted. Alternatively, install to a user-writable directory:
curl -fsSL https://raw.githubusercontent.com/mhm13dev/git-snapshot/main/install.sh | bash -s -- ~/.local/bin

Command not found after installation

If you get command not found: git-snapshot:
  1. Check if the install directory is in your PATH:
    echo $PATH
    
  2. If the install directory is missing, add it to your shell configuration (see “Add to PATH” above)
  3. Reload your shell:
    source ~/.bashrc  # or ~/.zshrc
    

curl vs wget

The installer works with both curl and wget:
# Using curl (recommended)
curl -fsSL https://raw.githubusercontent.com/mhm13dev/git-snapshot/main/install.sh | bash

# Using wget
wget -qO- https://raw.githubusercontent.com/mhm13dev/git-snapshot/main/install.sh | bash

Next steps

Quick start

Learn how to create and restore snapshots

Introduction

Understand when to use git-snapshot vs git stash