Complete guide to snapshot and symlink modes.
dotbak offers two fundamentally different approaches to managing your dotfiles.
Concept: Your files stay in their original locations. You manually create timestamped backups when ready.
# Add files to snapshot tracking
$ dotbak add --snapshot ~/.zshrc
✓ Added to snapshot tracking
# File structure:
~/.zshrc ← Your actual file (NOT a symlink)
# Nothing backed up yet!
# Create snapshot when ready
$ dotbak snapshot
✓ Snapshot created: 2025-12-01-164520
# Backup structure:
~/.dotbak/snapshots/2025-12-01-164520/.zshrc ← CopyIn snapshot.toml:
[[files]]
original = "~/.zshrc"
type = "file"
added = "2025-12-01T15:38:03Z"File behavior:
- ✅ Original file stays in place
- ✅ No symlinks created
- ✅ You control when to backup
- ✅ Multiple versions kept (timestamped)
Perfect for:
- Experimenting with configs
- Keeping version history
- Testing before committing
- Peace of mind (restore any version)
- Files you edit frequently
Example workflow:
# Morning: Create snapshot
dotbak snapshot
# Edit configs all day
vim ~/.zshrc ~/.vimrc ~/.bashrc
# Evening: Create another snapshot
dotbak snapshot
# Oops, broke something!
dotbak snapshot restore 2025-12-01-090000Concept: Files are symlinked to backup location. Every change is immediately backed up.
# Add file to symlink tracking
$ dotbak add --symlink ~/.tmux.conf
File structure:
~/.tmux.conf → ~/.dotbak/symlinks/.tmux.conf (symlink)
# In symlink.toml:
[[files]]
original = "~/.tmux.conf"
backup = "symlinks/.tmux.conf"
type = "file"When adding a directory with --symlink, you get two choices:
~/.config/nvim → ~/.dotbak/symlinks/.config/nvim/ (single symlink)
# ALL files inside are automatically backed up
# New files are auto-synced (no detection needed)~/.config/nvim/ (real directory, NOT symlinked)
├── init.lua → ~/.dotbak/symlinks/.config/nvim/init.lua
└── plugins.lua → ~/.dotbak/symlinks/.config/nvim/plugins.lua
# Only tracked files are symlinked
# New files are DETECTED and require actionPerfect for:
- Configs that rarely change
- Files you want always backed up
- Simple, set-and-forget approach
- When you don't need version history
Example workflow:
# Add once
dotbak add --symlink ~/.tmux.conf
# Edit anytime
vim ~/.tmux.conf
# Changes automatically saved to backup!
# No need to run any commandsDetection ONLY applies to symlink mode with individual file symlinks ([F] option).
$ dotbak symlink-sync
# OR
$ dotbak sync (alias)If you tracked:
[[files]]
original = "~/.config/nvim/init.lua"
type = "file"
[[files]]
original = "~/.config/nvim/plugins.lua"
type = "file"Directory to scan:
~/.config/nvim/ ← Only this directory
Detection result:
$ touch ~/.config/nvim/new-plugin.lua
$ dotbak symlink-sync
Found 1 new file:
~/.config/nvim/new-plugin.lua
[A]dd / [I]gnore now / i[G]nore always / [Q]uit?- ✅ Scans only directories containing symlink-tracked files
- ✅ Only with individual file symlinks ([F] mode)
- ❌ Does NOT scan if directory symlink ([D] mode) - auto-synced already
- ❌ Does NOT scan snapshot-tracked directories
- ❌ Does NOT scan HOME directory (
~/) - too noisy - ❌ Does NOT scan sibling directories
| Feature | Snapshot Mode | Symlink Mode |
|---|---|---|
| File location | Original location | Symlinked to backup |
| Backup timing | Manual (on demand) | Automatic (every change) |
| Version history | ✅ Timestamped snapshots | ❌ Single version only |
| Time-travel | ✅ Restore any version | ❌ Only current backup |
| Experimentation | ✅ Perfect | |
| New file detection | ❌ Not needed | ✅ For [F] mode only |
| Overhead | Low (copies when needed) | None (live sync) |
| Best for | Configs you edit often | Configs you rarely touch |
Use both modes together!
- Shell configs (
.zshrc,.bashrc,.profile) - Editor configs (
.vimrc,init.lua) - App configs you experiment with
- Any file you want version history
- Stable configs (
.tmux.conf,.gitconfig) - Large directories you don't edit often
- Files you want always backed up
# Snapshot mode (editing frequently)
dotbak add --snapshot ~/.zshrc
dotbak add --snapshot ~/.vimrc
dotbak add --snapshot ~/.config/nvim
# Symlink mode (rarely change)
dotbak add --symlink ~/.tmux.conf
dotbak add --symlink ~/.gitconfig
dotbak add --symlink ~/.ssh/config
# Create first snapshot
dotbak snapshot
# Check everything
dotbak status
dotbak listFor practical examples, see Common Workflows.