views:

851

answers:

9

I have 3 Linux machines, and want some way to keep the dotfiles in their home directories in sync. Some files, like .vimrc, are the same across all 3 machines, and some are unique to each machine.

I've used SVN before, but all the buzz about DVCSs makes me think I should try one - is there a particular one that would work best with this? Or should I stick with SVN?

+3  A: 

Any DVCS would likely work fine. My favorite is Bazaar. It would be easiest to keep your config files in .config, version that, and then symlink as appropriate.

A benefit of DVCS is that you can version the per-machine config files as well, without interfering with versioning global configs.

John Millikin
A: 

Version control software isn't really great for home directories. Worse, some software doesn't really like the .svn folders or starts to interpret their contents. You could of course try to fix this with some very complex mirroring setup, but that's hard.

Paul de Vrieze
+2  A: 

I've had the same problem, and built a tool on top of Subversion that adds permission, ownership and secontext tracking, keeps the .svn directories out of the actually versioned trees, and adds a concept of layers so you can for example track all your config related to development, which you then only check out on machines you use for developing.

This has helped me organize my settings much better across the 50+ machines I log into.

Here's the project page. It's still a little rough around the edges, but we also use it at work to version system configuration for our 60+ servers.

In general, any version control system that uses some sort of metadata files to track stuff is going to cause you pain as is when actually using it.

Thomas Vander Stichele
A: 

Here's a Mozilla developer that's tried to do this: Version controlling my home dir, there's a couple of suggestions in the comments.

Sam Hasler
+4  A: 

I've had this problem for years, and I don't think version control is necessarily the right way to go. I've had good success with the the Unison file synchronizer which is designed for the express purpose of maintaining consistent home directories on two machines. I'm currently managing seven replicas with unison, and the details are a bit tricky, but it is a great tool and if you start with two you will be extremely pleased.

The key difference between Unison and a VCS is that Unison is willing to delay dealing with conflicts that have to be merged. Plus it gets all the defaults right. And it is fast: I use it daily, over a DSL line, to synchronize about 40GB of data.

Norman Ramsey
Thanks for the tip about Unison! I thought VCS was what I needed, but I actually don't care about the versioning, just the synchronization, so Unison is much better. Plus having (e.g) bazaar checkouts within a bazaar-versioned home directory seems problematic.
Patrick
A: 

git or Mercurials's cheap branching would work great for this situation. I started with Mercurial, because it is simpler, but have subsequently moved to git.

Flemish Bee Cycle
A: 

One way to handle this very flexibly is to have a build directory under revision control, not try and svn your actual home directory (which has its own issues)

so inside this you keep a structure like

/home/you/code/dotfiles
/home/you/code/dotfiles/dotbashrc
/home/you/code/dotfiles/dotemacs
...
/home/you/code/dotfiles/makefile

and the makefile can contain logic for specializing files (or not)

might be heavier than you need, but if your actual setup is complex (I've done this across 3 or 4 different unices at a time) then it's worth doing something like this.

simon
A: 

I use git for this. So far, I have been able to keep the home directories on several machines synchronized, with no need for branching and merging. Instead, I use git rebase. Conflicts so far have been few and far between and easy to resolve.

I keep files that need to have separate contents out of revision control by putting them into .gitignore.

I keep configuration files for the following tools in git:

  • various shells
  • emacs and applications, i.e.
    • gnus
    • BBDB
    • emacs-w3m
  • mutt
  • screen
  • various utilities and scripts

I keep notes and such in a subdirectory which has its own git repository.

hillu
A: 

I would suggest looking into etckeeper if you haven't already. It's designed for versioning configuration files in /etc using a version control system:

etckeeper is a collection of tools to let /etc be stored in a git, mercurial, darcs, or bzr repository. It hooks into apt (and other package managers including yum and pacman-g2) to automatically commit changes made to /etc during package upgrades. It tracks file metadata that revison control systems do not normally support, but that is important for /etc, such as the permissions of /etc/shadow. It's quite modular and configurable, while also being simple to use if you understand the basics of working with revision control.

Although it's designed for /etc I think it would probably also work well (perhaps with some adaptation) for home directories since the basic needs are the same.

Jay