Skip to content

HarshPatel5940/stash

Repository files navigation

📦 Stash

Test Go License

Encrypted backup for macOS dotfiles, secrets, and configs.


⚠️ Critical

Need BOTH to restore:

  • 🔑 ~/.stash.key → Password manager
  • 📦 .tar.gz.age → Cloud/external drive

Store separately. Lose either = lose everything.


Install

Homebrew:

brew install harshpatel5940/tap/stash

Go:

go install github.com/harshpatel5940/stash@latest

Usage

# Setup
stash init

# Backup
stash backup

# List backups
stash list

# Show metadata + note
stash info 1

# Restore by ID or name (copy .stash.key first!)
stash restore 1

What Gets Backed Up

  • Dotfiles: Shell configs (.zshrc), git configs, etc.
  • Secrets: SSH keys, GPG keys, AWS credentials.
  • Dev Secrets: .env and .pem files from your projects.
  • Configs: ~/.config (with smart exclusions like node_modules).
  • Packages: Homebrew, npm, VS Code extensions, Mac App Store apps.
  • Browser Data: Optional bookmarks/extensions/settings backup (disabled by default).
  • Git Repos: Tracks all your git repositories for easy re-cloning.
  • System: macOS defaults/preferences, custom fonts, shell history.

Flags

Backup:

  • --skip-browsers - Force-skip browser data for this run
  • --keep <n> - Keep only last N backups (default: 5)
  • -m, --message - Add note/message to backup
  • --dry-run - Preview what will be backed up
  • --verbose - Detailed output
  • --no-encrypt - Skip encryption (not recommended)

Restore:

  • --dry-run - Preview
  • --editor - Pick/drop files and packages in editor (git-rebase style)
  • --no-tui - Use Y/n prompts instead of interactive TUI
  • --no-decrypt - Unencrypted backup

Info:

  • stash info <id|name> - Show backup metadata and note
  • stash info <id|name> -m "..." - Update note for a backup

Config:

  • stash config edit - Interactive TUI editor for common settings
  • stash config edit --raw - Open raw YAML in VISUAL/EDITOR/vim

Interactive Restore

By default, restore opens an interactive TUI to select what to restore:

  1. Choose categories: multi-select across dotfiles, Homebrew, VS Code, macOS defaults, etc.
  2. Pick files: if dotfiles selected, choose individual files to restore
  3. Pick packages: if Homebrew selected, choose to install all or pick individual packages

Use --editor for a git-rebase style text editor instead:

pick [BREW] Install Homebrew packages
drop [MAS ] Install Mac App Store apps
pick [CODE] Install VS Code extensions

pick [FILE] ~/.bashrc (2.3 KB)
drop [FILE] ~/.ssh/id_rsa (skip this)
pick [DIR ] ~/.config

Change pickdrop to skip. Save & close.


Config

Edit ~/.stash.yaml:

search_paths:
  - ~/projects
  - ~/work

exclude:
  - "*/node_modules/*"
  - "*/vendor/*"
  - "*/.git/*"

additional_dotfiles:
  - .custom_aliases

backup_dir: ~/stash-backups
encryption_key: ~/.stash.key

browsers:
  enabled: true

After Restore

# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Restore packages
brew bundle --file=packages/Brewfile
cat packages/vscode-extensions.txt | xargs -L 1 code --install-extension

# Restart terminal
# Test SSH, AWS, etc.

Development

See CONTRIBUTING.md

make build
make test

License

MIT - see LICENSE


GitHubIssues

About

Stash your Mac, restore anywhere

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors

Languages