Skip to main content

atomic stash

Temporarily save uncommitted changes.

Synopsis

atomic stash [SUBCOMMAND]

Description

The stash command saves your uncommitted working copy changes to a temporary orphan view, then restores the working copy to a clean state. This is useful when you need to switch views but have changes that belong elsewhere, or when you need a clean working copy for a different task.

Stashes are stored as lightweight orphan views under the stash/ namespace. They persist until explicitly dropped or popped.

Subcommands

stash (no subcommand)

Save uncommitted changes and restore a clean working copy.

# Save all uncommitted changes
atomic stash

# Save with a message
atomic stash -m "WIP: auth refactor"

Options:

OptionDescription
-m, --message <TEXT>Descriptive message for the stash
--include-untrackedAlso stash untracked files
--keepSave to stash but don't revert the working copy

pop

Apply the most recent stash and remove it.

# Apply and remove the most recent stash
atomic stash pop

# Apply and remove a specific stash
atomic stash pop stash@{2}

If the stash applies cleanly, it is automatically removed from the stash list. If there are conflicts, the stash is preserved so you can resolve and retry.

apply

Apply a stash without removing it from the stash list.

# Apply the most recent stash (keep it in the list)
atomic stash apply

# Apply a specific stash
atomic stash apply stash@{1}

This is useful when you want to apply the same changes to multiple views.

list

List all saved stashes.

atomic stash list

Example output:

stash@{0}: On main — WIP: auth refactor (2 minutes ago)
stash@{1}: On feature — debugging session cleanup (1 hour ago)
stash@{2}: On main — (3 days ago)

Each entry shows:

  • The stash index
  • The source view
  • The stash message (if provided)
  • How long ago it was created

drop

Delete a stash without applying it.

# Drop the most recent stash
atomic stash drop

# Drop a specific stash
atomic stash drop stash@{1}

To delete all stashes at once, use clear instead of drop.

clear

Delete all stashes.

# Delete every stash (prompts for confirmation)
atomic stash clear

# Skip the confirmation prompt
atomic stash clear --force

Options:

OptionDescription
-f, --forceSkip confirmation prompt

show

Show the contents of a stash (what files were changed).

# Show the most recent stash
atomic stash show

# Show a specific stash
atomic stash show stash@{2}

# Show full diff
atomic stash show --patch

Options:

OptionDescription
-p, --patchShow full diff output instead of just the file list

How It Works

Under the hood, stashes are implemented as orphan views:

  1. Save — Creates a temporary view named stash/auto_{timestamp} (or stash/{source}_{timestamp}_{message}), records all working copy changes to it, then reverts the working copy.

  2. Pop/Apply — Switches to the stash view, reads the recorded changes, applies them to the current working copy, and (for pop) deletes the stash view.

  3. Drop — Deletes the orphan view and its recorded changes.

Because stashes are just views, they participate in the normal Atomic graph — they're content-addressed, use the same change format, and can even be pushed to remotes if needed.

Examples

Save changes before switching views

# You're working on feature-auth but need to fix a bug on main
atomic stash -m "WIP: auth middleware"
atomic view switch main

# Fix the bug
atomic record -m "Fix null pointer in config parser"

# Go back and restore your work
atomic view switch feature-auth
atomic stash pop

Apply the same changes to multiple views

# Stash the changes
atomic stash -m "shared config update"

# Apply to first view
atomic view switch staging
atomic stash apply

# Apply to second view
atomic view switch production
atomic stash apply

# Clean up the stash
atomic stash drop

Clean up old stashes

# See what's stashed
atomic stash list

# Drop everything
atomic stash clear

Differences from Git

AspectGitAtomic
StorageSpecial ref outside branch modelOrphan view (same graph model)
IdentityIndex-based only (stash@{0})Index-based, with source view and message
Conflicts on popPossible, stash keptPossible, stash kept
Push to remoteNot possiblePossible (it's just a view)
Untracked filesRequires --include-untrackedRequires --include-untracked

See Also

  • view — Managing views
  • record — Recording changes
  • restore — Discarding working copy changes
  • status — Viewing working copy status