Getting a handle on your dotfiles

This document is obsolete. Just use git, mercurial or subversion to create a workspace in the root of your homedir. See as an example.

So, you have 15 dotfiles and you use them regularly on 7 different machines. Sometimes you tweak a file and forget which account on which machine has the most updated .muttrc or .vimrc. This is a brief tutorial on managing your dotfiles with CVS. (Shameless plug: If you are not familiar with CVS, have a read through our brief introduction to CVS.)

1. Importing your dotfiles.

The initial procedure went something like this. First, I copied my relevant dotfiles to a temp directory from which they would be imported into CVS. In the process, I removed the initial dot because it is a pain to work with on a daily basis:

$ pwd
$ mkdir tmp
$ cp .muttrc tmp/muttrc
$ cp .slrnrc tmp/slrnrc
$ cp .vimrc tmp/vimrc

And so on. You probably want to look carefully at the output of ls -a in your home directory and determine which dotfiles are suitable for versioning.

Once I had all the files I need, I imported them to my CVS repository:

$ cd tmp
$ cvs -d /path/to/repository import dotfiles holsta dotfiles_0_1

This import only needs to be done once, and you can easily cvs add any additional files later.

2. Deploying the versioned dotfiles in your environment

Now you will want to deploy these files on the various machines you use. Being able to manage these files under CVS and use them on the daily basis requires a little trick, because we don't really want CVS/ directories in the root of our home directory. For this reason, we checkout our files to a suitable directory, and since we will not be working with it every day, we hide it by prefixing the name with a dot:

$ cvs -d /path/to/repository co -d .dotfiles dotfiles

This creates ~/.dotfiles with all our needed files, but is not quite what we want considering mutt uses ~/.muttrc, not ~/.dotfiles/muttrc.

If you perform this CVS operation on every machine you use regularly, you can upgrade to the latest set of dotfiles simply by running cvs update in the .dotfiles directory. It helps your situation if you place the repository with your dotfiles on a machine you can always get to.

3. Creating an install script

So, create a Makefile or shell script similar to the one I have created. It will create links in your home directory, so that ~/.muttrc becomes a link to ~/.dotfiles/muttrc. This lets applications find the correct configuration files without much hassle, and still gives you a seperate directory for CVS operations. Do note that some applications do not like symlinks (e.g. procmail), and hence the 'ln' command might need to be replaced with 'cp'.

Now activate the symlinked files:

$ make shell		(or whatever you used)

4. Manage your dotfiles

When you need to make a change just edit the required file and commit it to the repository.

$ vim .vimrc
$ cd .dotfiles
$ cvs ci -m "email and news textwidth is 72" vimrc

This setup means you will virtually have working directories with this module on each of the machines, and if you don't apply some simple rules, it too can become hard to manage. Make it a habit to commit a file as soon as you are happy with the change. Otherwise you will have locally modified copies on half of your machines, and having to resolve conflicts by hand is so boring.

Template files