Alex Rivera | Logout

Managing user configuration files across multiple computers

Asked 2009-09-11T20:17:38.877
40

I commonly work on multiple computers. I have various configuration files, eg, .bashrc, .gitconfig, .irbrc, .vimrc and configuration folders, eg, .vim/ that contain valuable customizations. Sometimes I want small variations in configuration between the different computers.

I want to use version control to manage these different files.

  • do others use version control to manage their configuration files?
  • what are some hints that might make this easier?
  • what's the most elegant way of dealing with variations between the computers?
  • I'm comfortable with git; any other suggestions?
Edit
Report

3 Answers

18

I keep a folder at ~/config/ which is a bzr repository. I push/pull the repository between my various computers to sync it up. I have an install script which I use to make symlinks to my home directory:

#! /bin/sh
# link all files to the home directory, asking about overwrites
cd `dirname $0`
SCRIPT_DIR=`pwd`
SCRIPT_NAME=`basename $0`
FILES=`bzr ls --versioned --non-recursive`

cd $HOME
for FILE in $FILES; do
    ln --symbolic --interactive $SCRIPT_DIR/$FILE
done
rm $TARGET_DIR/$SCRIPT_NAME

If you want to use git instead of bzr, you can instead use:

FILES=`git ls-tree --name-only HEAD`

(I had to ask SO to figure that out)

EDIT: I don't actually do this anymore, now I have a dotfiles repo on github, with a nice rake install script that someone else wrote.

answered 2009-09-17T20:54:04.907
3

If you use git, you could define an "origin" repo to be the master; and then do a clone on each computer you work. you could use a branch for every computer to have your set of config files.

answered 2009-09-11T20:25:38.983
2

Here are some dotfile managers:

  • homesick: Based on Ruby
  • homeshick: Same as first one, but without ruby dependency
  • dfm: Written in Perl
answered 2013-07-23T12:57:04.450

Your Answer