*nix dotfile heaven with git + post-merge hook


I've horsed around with managing my dotfiles using svn and git but never took a really systematic approach before. Now I've seen the light! I introduce to you git-dotfiles.

What is it?

  • a python script that implements a semi-intelligent post-merge git hook to help you manage your dotfiles via git

What does it do?

  • Basically, once you spend a couple of minute setting it up every time you login to a host all your git-managed dotfiles will automatically update. sweet, eh?

Where can i get it?

  • git clone git://kingfisherops.com/git-dotfiles

How does it work?

  • git will automatically execute a post-merge hook after a git pull operation that pulls in changes
  • The git-dotfiles post-merge script works like this: (taking .bashrc as an example)
  • .bashrc is in the ~/.git-dotfiles repo
  • If there is already a ~/.bashrc then archive it to ~/.git-dotfiles_archive/.bashrc_DD.MM.YYYY_HH:MM:SS
  • If there is already a ~/.bashrc but it's not symlinked into ~/.git-dotfiles/ then archive the symlink target
  • Delete ~/.bashrc and replace it with a symlink to ~/.git-dotfiles/.bashrc
  • Detect stale symlinks in ~/ that point at nonexisting targets in ~/.git-dotfiles/ and remove them (handles the rm / mv case)
  • Btw, it works for both files and directories (if that wasn't obvious.)

More details

  • See the readme.txt available in the above git repo or read the source yourself