On managing dotfiles with vcsh and mr
Posted on Sun 15 June 2025 in Tooling
My dotfiles live in separate Git repositories: one for zsh, one for Vim, one for Git itself and a small meta repository that ties them together. I want the files in place, not symlinked from a central directory, and I want one command to clone or update everything on a new machine. vcsh and mr give me both. I have used this approach since 2014, when I made the first commit to config-mr, and I am still super happy with it.
What vcsh does
vcsh runs Git with GIT_DIR set to ~/.config/vcsh/repo.d/<name>.git and GIT_WORK_TREE set to $HOME. vcsh clone checks the repository out directly into your home directory, so .zshrc is a real file and not a symlink. Each repository has its own history, and no .git directory appears next to your dotfiles.
The last argument names the repository after the area it manages:
vcsh clone git@github.com:stefanjenkner/config-zsh.git zsh
After that, vcsh zsh status, vcsh zsh add .zshrc and vcsh zsh commit operate on that repository with $HOME as the work tree.
To see which files belong to a repository, run vcsh zsh ls-files:
.config/mr/config.d/zcomet.git
.zprofile
.zshrc
The work tree is the whole home directory. Use explicit paths with vcsh ... add; git add . from $HOME will pick up everything you have not ignored.
What mr adds
vcsh solves storage and checkout for one repository. mr solves the set. It reads ~/.mrconfig, runs a command in every repository it knows about and can work in parallel.
My meta repository, config-mr, contains only .mrconfig and two directories of helper scripts. After installing vcsh and mr, the first checkout is the only manual step:
vcsh clone git@github.com:stefanjenkner/config-mr.git mr
mr checkout
mr checkout walks the configuration, runs vcsh clone for the other dotfiles repositories and clones the plugin repositories as well.
.mrconfig has one section per repository:
[DEFAULT]
git_update = git pull --ff-only "$@"
jobs = 5
[.config/vcsh/repo.d/zsh.git]
checkout = vcsh clone git@github.com:stefanjenkner/config-zsh.git zsh
[.config/vcsh/repo.d/vim.git]
checkout = vcsh clone git@github.com:stefanjenkner/config-vim.git vim
The section name is the path to the Git directory. mr checks whether that path exists. If it does not, mr runs the checkout command. jobs = 5 updates five repositories at a time.
The include trick
The part that makes the combination work is include. It runs a shell command and treats its output as more configuration:
[DEFAULT]
include =
for f in ~/.config/mr/lib.d/*; do
test -f $f && echo "lib = . $f"
done
cat ~/.config/mr/config.d/*
The first loop loads shell functions from lib.d. I use them in skip lines, for example to clone the VS Code configuration only on macOS:
[.config/vcsh/repo.d/vscode.git]
checkout = vcsh clone git@github.com:stefanjenkner/config-vscode.git vscode
skip = ! osx
The cat line reads every file in ~/.config/mr/config.d/. vcsh checks those files out from the individual repositories, so each repository contributes its own mr configuration. The meta repository does not need to list every plugin.
config-zsh uses this to manage zcomet and the zsh plugins it loads:
[.zcomet/bin]
checkout = git clone 'https://github.com/agkozak/zcomet.git' 'bin'
update = git pull --ff-only
push = :
[.zcomet/repos/zsh-users/zsh-autosuggestions]
checkout = git clone 'https://github.com/zsh-users/zsh-autosuggestions' 'zsh-autosuggestions'
update = git pull --ff-only
push = :
config-vim does the same for the packages under ~/.vim/pack/foo/start. The push = : line makes mr push a no-op for these third-party checkouts; I update them, but I do not push to them.
Daily use
Dotfiles changes stay in the repository they belong to:
vcsh zsh add .zprofile
vcsh zsh commit -m "Add Rancher Desktop to PATH"
vcsh zsh push
For the whole set:
mr status
mr update
mr update runs the update command in each repository; my default is git pull --ff-only. On a new machine, mr checkout does the cloning.
Tradeoffs
vcsh requires discipline. Two repositories cannot own the same file, because both check out into $HOME. A broad git add can stage unrelated files. I keep the repositories split by tool and use explicit paths.
The payoff is no symlinks, separate history per tool and one command to bootstrap or update the set. mr also handles the external plugin checkouts that do not belong in a dotfiles repository.
Further information: vcsh, mr, and my config-mr, config-zsh and config-vim repositories.