Skip to main content
The stash command saves your uncommitted changes temporarily, allowing you to switch contexts and come back to your work later. Unlike Git’s cryptic stash, wit provides clear, intuitive stash management.

Quick Reference

Saving Changes

Basic Stash

Stash with Message

What Gets Stashed

Viewing Stashes

List All Stashes

Show Stash Contents

Applying Stashes

Pop (Apply and Remove)

Apply (Keep Stash)

Use apply when you want to apply the same stash to multiple branches, or when you’re not sure if the application will succeed.

Removing Stashes

Drop Specific Stash

Clear All Stashes

wit stash clear is irreversible. The stashed changes will be permanently deleted.

Common Workflows

Quick Context Switch

Apply Stash to Different Branch

Preview Before Applying

Stash Specific Files

While wit stashes all changes by default, you can stage specific files first:

How wit Stash Differs from Git

Stash Internals

wit stores stashes in .wit/stash/stash.json as compressed JSON, containing:
  • File contents (base64 encoded)
  • File permissions
  • Staged vs. unstaged status
  • Branch name at stash time
  • Base commit hash
This means stashes are portable and can be inspected directly if needed.

Tips

Always use descriptive messages with wit stash save "message" to remember what each stash contains.
Use wit stash show before popping to ensure you’re applying the right stash.
Regularly review and clean up your stash list. Old stashes often become irrelevant.
If you’re stepping away for more than a few hours, consider using wit wip to create a WIP commit instead of stashing.

Troubleshooting

If applying a stash causes conflicts, resolve them manually and then drop the stash:
If you applied the wrong stash, you can undo:
Unfortunately, wit stash clear is permanent. Consider using wit snapshot for more persistent checkpoints.
  • wit wip - Create a quick WIP commit instead of stashing
  • wit snapshot - Create named checkpoints
  • wit switch - Switch branches (auto-stashes by default)