Dotfile Management

  • ~2 min read

A little over a year ago I spent a weekend migrating my dotfile/home directory management scheme from the usual monolithic ~/dotfiles/ directory with symlinks to the proper places (not even using something like homesick/homeshick or GNU Stow, just a makefile), to a much improved version using myrepos and vcsh.

At some point in 2013, I stumbled upon an old post by Penny LeachThis used to point to http://mjollnir.org/blog/migrating-my-homedirectory-from-one-repo-to-many/, but that has since died and that version doesn’t exist in an archive, so pointing to a version on her previous blog.

. Like her, I’ve found I tend to not commit changes to this stuff atomically. I change something, intending to commit it once I test it out to make sure it’s working, only to get on with working and forget about the committing part. Then I do the same thing with some other tool’s configuration and eventually end up with weeks of changes in a bunch of files all in a single repository.

Since Penny’s post (over five years ago at time of writing), vcsh has evolved (the vcsh script she mentions was deprecated) and is a bit nicer to work with. I just followed the vcsh docs and used the ‘Steal-from-Template’ way to get setup.

Pretty straightforward after that. My dotfiles now live in separate repositories for each program/tool and are the repositories starting with ‘dots-’ on gitlab. One very nice thing about this setup is now each tool’s configuration can be on separate branches at the same time. For instance, I’ve been reorganizing my vim dotfiles lately and for systems where I want to test the new configuration I just git checkout wip/reorg in the vim repo; no other tools configuration is touched and if something is broken, I can just git checkout master and old vim config is restored. Similar story if I ever need different configurations for different versions of a tool, or on different machines, just checkout the needed branch for the respective tool. This is a capability that is lacking in the single dotfiles repo scheme and it’s really useful to have.

With myrepos, managing a bunch of separate repositories is easy enough and to configure a new system it’s just:

cd
vcsh clone https://gitlab.com/doshitan/dots-mr.git mr
<tweak symlinks in ~/.config/mr/{available,config}.d/ if needed>
mr up

Basically, get your myrepos config setup, then have it set everything else up. If you’re still doing a monolithic dotfiles repository and/or symlinking stuff around, I strongly recommend giving the vcsh/myrepos combination a shot.