Repository navigation
Symlink Modes
symlinkit 2.0 supports four CRUD operations: Create, Overwrite, Merge, and Delete. Understanding when to use each mode is key to effective symlink management.
Create a new symlink safely without overwriting existing files.
- Succeeds: If destination doesn't exist
- Fails: If destination already exists (file or directory)
- Safe: Never overwrites existing content
# Create symlink to file
symlinkit -c ~/dotfiles/.bashrc ~/.bashrc
# Create symlink to directory
symlinkit -c ~/dotfiles/nvim ~/.config/nvim
# Preview first
symlinkit --dry-run -c ~/source ~/dest- First-time setup
- When you want to prevent accidental overwrites
- Testing symlink creation
- Setting up new configurations
Behaves identically to Merge Mode (-m):
# These are equivalent
symlinkit -cr ~/dotfiles ~/.config
symlinkit -m ~/dotfiles ~/.configReplace existing files or directories with symlinks.
- Removes existing file/directory at destination
- Creates symlink in its place
-
Destructive: Original content is deleted (use
--dry-runfirst!)
# Replace file with symlink
symlinkit -o ~/dotfiles/.zshrc ~/.zshrc
# Replace directory with symlink
symlinkit -o ~/dotfiles/nvim ~/.config/nvim
# ALWAYS preview first!
symlinkit --dry-run -o ~/source ~/dest- Replacing existing configs with symlinked versions
- Converting regular files to symlinks
- When you're certain you want to overwrite
--dry-run first:
# Step 1: Preview
symlinkit --dry-run -o ~/dotfiles/.vimrc ~/.vimrc
# Step 2: If looks good, apply
symlinkit -o ~/dotfiles/.vimrc ~/.vimrcRecursively creates symlinks with interactive prompts for conflicts:
symlinkit -or ~/dotfiles ~/.configFor each conflict, you'll be prompted:
⚠️ Conflict: ~/.config/existing.txt exists.
[s]kip / [o]verwrite / [a]ll overwrite / [c]ancel >
Recursively symlink directory contents into destination.
- Traverses source directory recursively
- Creates symlinks for each file/subdirectory
- Preserves destination directory structure
- Interactive prompts for conflicts
# Merge dotfiles into home directory
symlinkit -m ~/dotfiles/.config ~/.config
# Preview merges
symlinkit --dry-run -m ~/source ~/destBefore:
~/dotfiles/scripts/
├── backup.sh
└── deploy.sh
~/bin/
└── old.sh
Command:
symlinkit -m ~/dotfiles/scripts ~/binAfter:
~/bin/
├── backup.sh -> ~/dotfiles/scripts/backup.sh
├── deploy.sh -> ~/dotfiles/scripts/deploy.sh
└── old.sh (preserved)
When a file already exists at the destination:
⚠️ Conflict: ~/bin/backup.sh exists.
[s]kip / [o]verwrite / [a]ll overwrite / [c]ancel >
Options:
-
s- Skip this file -
o- Overwrite this file with symlink -
a- Overwrite all remaining conflicts -
c- Cancel operation
- Dotfiles management
- Distributing scripts across directories
- Gradually symlinking configs
- Preserving existing files while adding new symlinks
Remove symlinks safely without affecting their targets.
- Removes the symlink
- Preserves the target file/directory
- Safe: Only deletes symlinks, never the source
# Delete single symlink
symlinkit -d ~/.config/nvim
# Preview deletion
symlinkit --dry-run -d ~/.bashrcOnly symlinks can be deleted:
# This file is a symlink
symlinkit -d ~/.zshrc
# ✅ Deleted successfully
# This file is NOT a symlink
symlinkit -d ~/real-file.txt
# ❌ Error: Not a symlinkInteractively delete all symlinks in a directory:
symlinkit -dr ~/binFor each symlink found:
~/.local/bin/script.sh -> ~/dotfiles/scripts/script.sh
[d]elete / [a]ll delete / [s]kip / [q]uit >
Options:
-
d- Delete this symlink -
a- Delete all remaining symlinks -
s- Skip this symlink -
q- Quit and exit
- Cleaning up symlinks
- Removing outdated configurations
- Undoing symlink operations
- Auditing symlink usage
| Mode | Flag | Overwrites? | Recursive | Use Case |
|---|---|---|---|---|
| Create | -c |
No |
-cr (= merge) |
Safe initial setup |
| Overwrite | -o |
Yes |
-or (prompts) |
Replace existing files |
| Merge | -m |
Prompts | Yes | Dotfiles management |
| Delete | -d |
N/A |
-dr (prompts) |
Clean up symlinks |
Always test with --dry-run first!
# Preview create
symlinkit --dry-run -c ~/source ~/dest
# Preview overwrite
symlinkit --dry-run -o ~/source ~/dest
# Preview merge
symlinkit --dry-run -m ~/source ~/dest
# Preview delete
symlinkit --dry-run -d ~/symlink# GOOD: Check first
symlinkit --dry-run -o ~/dotfiles/.vimrc ~/.vimrc
symlinkit -o ~/dotfiles/.vimrc ~/.vimrc
# BAD: Direct overwrite
symlinkit -o ~/dotfiles/.vimrc ~/.vimrc # RISKY!# First time setup
symlinkit -c ~/dotfiles/.bashrc ~/.bashrc# Gradually add symlinks
symlinkit -m ~/dotfiles ~/.config# Remove symlinks cleanly
symlinkit -d ~/.config/nvim- Inspection Tools - Learn to analyze existing symlinks
- Usage Examples - See real-world scenarios
- API Reference - Complete flag documentation
Symlinkit Wiki Navigation
Getting Started
Features & Functionality
Development & Contributing