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 rename command changes the name of a snapshot while preserving its hash and contents.

Syntax

git-snapshot rename <name> <new-name>

Parameters

  • name: The current snapshot name or hash
  • new-name: The new name for the snapshot

Examples

Rename a snapshot

git-snapshot rename my-feature better-name
Output:
Renamed: my-feature.a1b2c3d4.snapshot -> better-name.a1b2c3d4.snapshot

Rename using hash

git-snapshot rename a1b2c3d4 final-version
Output:
Renamed: a1b2c3d4.snapshot -> final-version.a1b2c3d4.snapshot

Rename an unnamed snapshot

You can add a name to a snapshot that was created without one:
git-snapshot rename a1b2c3d4 my-work
Output:
Renamed: a1b2c3d4.snapshot -> my-work.a1b2c3d4.snapshot

Behavior

  • The hash portion of the snapshot filename remains unchanged
  • The snapshot’s internal metadata is updated with the new name
  • The original snapshot file is removed after the renamed version is created
  • The operation is atomic - if renaming fails, the original snapshot is preserved

Technical details

The rename process:
  1. Extracts the snapshot contents to a temporary directory
  2. Updates the name field in the snapshot’s metadata.json
  3. Creates a new snapshot file with the new name and same hash
  4. Deletes the original snapshot file

Error handling

Missing parameters

git-snapshot rename my-feature
Output:
Error: Please provide snapshot name/hash and new name
Usage: git-snapshot rename <name> <new-name>

Snapshot not found

git-snapshot rename nonexistent new-name
Output:
Error: Snapshot 'nonexistent' not found

Multiple matches

git-snapshot rename feature new-name
Output:
Error: Multiple snapshots match 'feature'. Specify the hash.
To resolve this, use the specific hash:
git-snapshot rename a1b2c3d4 new-name

Name already exists

git-snapshot rename old-name existing-name
Output:
Error: Snapshot 'existing-name.a1b2c3d4.snapshot' already exists
You can only rename snapshots from the current repository. The command filters snapshots by repository when searching for matches.

Use cases

Fix a typo in the name

git-snapshot rename expirement experiment

Make names more descriptive

git-snapshot rename wip work-in-progress-auth-refactor

Organize snapshots

git-snapshot rename temp final-before-merge

Add context to unnamed snapshots

git-snapshot list
# Shows: a1b2c3d4
git-snapshot rename a1b2c3d4 pre-deployment-state

Build docs developers (and LLMs) love