How Stow works
Stow operates on the concept of “packages”. In this dotfiles repository, the entire directory is treated as a single package, with the repository root representing your home directory structure. When you run Stow, it:- Traverses the package directory
- Creates symbolic links in the parent directory (your home directory)
- Mirrors the directory structure
- Skips files listed in
.stow-local-ignore
Stow creates links from your home directory to the files in your dotfiles repository. This means you can edit files in place, and changes are immediately tracked by Git.
Basic usage
Installing dotfiles
From your dotfiles repository directory:Removing dotfiles
To remove all symlinks created by Stow:-D flag (delete) removes symlinks but preserves the files in your dotfiles repository.
Restowing dotfiles
If you’ve added new files or changed the structure:-R flag (restow) first removes existing symlinks, then creates new ones. This is useful after pulling updates.
Dry run
To see what Stow would do without making changes:Ignore patterns
The.stow-local-ignore file specifies patterns for files and directories that Stow should skip when creating symlinks.
.stow-local-ignore
The patterns use regular expressions. The
^/ prefix matches files only at the repository root, while patterns without it match anywhere in the tree.Common exclusions explained
Version control files
Version control files
Files like
.git, .gitignore, and .gitmodules are excluded because they’re used for repository management and shouldn’t be symlinked to your home directory.README and LICENSE
README and LICENSE
Documentation files at the repository root (
^/README.*, ^/LICENSE.*) are excluded since they’re for the repository itself, not part of your system configuration.install.sh
install.sh
The installation script is excluded because it’s a helper script for setting up the dotfiles, not a configuration file to be linked.
Font files (.ttf)
Font files (.ttf)
Font files are excluded because they should be installed to the system font directory rather than symlinked from the dotfiles repository.
Troubleshooting
Existing files conflict
If Stow encounters existing files that aren’t symlinks, it will abort with an error:Broken symlinks
To find broken symlinks in your home directory:Verifying symlinks
To check if a file is a symlink and where it points:Advanced usage
Stow with different target directory
By default, Stow uses the parent directory as the target. To specify a different target:Multiple packages
You can organize dotfiles into multiple packages and stow them selectively:Adopting existing files
The--adopt flag moves existing files into your dotfiles repository and replaces them with symlinks:
Integration with the install script
This dotfiles repository includes aninstall.sh script that automates the Stow process along with other setup steps. See the Installation guide for details.
Related resources
Installation
Set up the dotfiles with the install script
GNU Stow manual
Official GNU Stow documentation