| Crates.io | stash-rs |
| lib.rs | stash-rs |
| version | 0.2.0 |
| created_at | 2026-01-01 22:48:59.994181+00 |
| updated_at | 2026-01-08 23:18:59.181415+00 |
| description | Stack-based file management for the terminal. |
| homepage | |
| repository | https://github.com/what386/stash-rs |
| max_upload_size | |
| id | 2017650 |
| size | 129,409 |
Stash is a stack-based file management tool for the terminal. It lets you temporarily move files and directories out of your working tree, then restore them later.
Stash is designed to feel obvious: in many cases, you don’t need to specify whether you’re pushing or popping — Stash infers your intent based on context.
cargo install stash-rs
Ensure Cargo’s bin directory is in your PATH:
export PATH="$HOME/.cargo/bin:$PATH"
Requires Rust and Cargo:
git clone https://github.com/what386/stash-rs.git
cd stash-rs
cargo build --release
Executable:
./target/release/stash-rs
All commands support --help:
stash --help
Stash tries to “do the right thing” based on context.
# Stash a file (it exists locally)
stash file.txt
# Restore it later (file no longer exists locally)
stash file.txt
# Restore the most recent entry
stash
You can always force a specific operation using flags such as --push or --pop.
When you run:
stash [items...]
Stash determines what you mean using a small set of predictable rules.
No arguments → Pop (restore) the most recent entry
All arguments exist as paths in the current directory → Push (stash) those files or directories
Argument matches a stashed entry name → Pop that entry
Argument matches files inside a stashed entry → Pop the entry containing those files
Ambiguous or no match → Prompt for clarification or require explicit flags
# No args → restore most recent
stash
# File exists in the current directory → stash it
stash notes.txt
# File is not in the current directory, but entry name matches → restore
stash notes.txt
# Multiple paths in current directory → stash together in one entry
# Multiple path entries are the first item's filename..
stash readme.md license
# Or passed explicitly via the "--name <NAME>" flag
stash data/ schema.sql -n project-data
If a name refers to both a local file and a stashed entry:
stash work.txt
Stash will prompt you to resolve the issue:
Multiple matches found:
1. File "work.txt" in current directory (push)
2. Stashed entry "work.txt" (pop)
Select an option (1–2), or use --push / --pop to specify.
You can control this behavior via configuration or bypass it entirely using explicit flags.
Explicit flags always override inference:
stash --push work.txt # Always stash
stash --pop work.txt # Always restore
stash --peek work.txt # Copy out without removing
stash <file1> [file2 ...] [options]
Options:
--name / -n <NAME> – Name the entry--copy / -c – Copy instead of move--link / -l – Leave symlinks behindExamples:
stash file.txt dir/
stash src/ -n "project-source-old"
stash document.pdf --copy
stash config/ --link
stash --pop [identifier] [options]
Options:
--copy / -c – Copy instead of move--force / -f – Overwrite existing files--restore – Restore to original pathsExamples:
stash
stash "project-backup"
stash --restore
stash --copy
stash --peek [identifier]
Examples:
stash --peek
stash --peek work-files
stash --list
Displays:
stash --search <pattern>
stash --search project
stash --info [identifier]
stash --info
stash --info backup-2024
stash --clean [days]
stash --clean
stash --clean 7
stash --rename <old:new>
stash --rename "temp:production-backup"
stash --tar <output-file>
stash --tar backup.tar
stash --dump [--delete]
stash --dump
stash --dump --delete
stash old-code/ notes.txt
# work on something else
stash
stash src/ --name feature-x
stash src/ --name bugfix-y
stash feature-x --restore
# create config-backup, move to stash
stash config/ --copy --name config-backup
# restore config-backup from stash
stash config-backup
Contributions are welcome! Issues and pull requests can be submitted on GitHub.