Using Subversion to Maintain your Configuration Files
I got this tip from Jerry Jackson who told me about storing all of my configuration files, like .bash_profile or .vimrc, in an etc directory inside of my home directory. Once the files are in that directory, you could create a subversion repository; and inside of this repository, put the etc directory in that. Once the files are in a repository, you can check out that repository on any machine. Now you have a way to keep all of your config files easily in sync.
Setting Up ~/etc
Since /etc contains any configuration file, why not have the home directory mimic this?
So I have moved a bunch of files into ~/etc:
.bash_profile.bashrc.irbrc.subversion/.vim/.vimrc
When I moved the files, I renamed them to not include the dot in front of the name, that way the files would not be hidden.
So that everything still works correctly, I make a bunch of symlinks for the files in my etc directory to the home directory, i.e. ln -s ~/etc/bashprofile ~/.bashprofile. This is so that the configuration files work like they used to.
The Subversion Repository
By moving these files into a directory, that directory can now be put into a repository. This is the beauty of it all. Once in a repository, the etc directory can be checked out anywhere. This means that anytime I want to change a config, like a new wim setting, I can make sure that vim behaves the same no matter what machine I’m using by committing that change and then performing an update.
Because I’m using subversion, I can use properties like svn:ignore on something that I don’t want have shared between my machines. I committed etc/subversion/ because I want to share the config file located in that directory. As for all other files, I don’t want to share it. So i put an ignore of * on that directory.
You can also use svn:externals. I use Tim Pope’s rails vim file. He keeps his work in subversion, so by using the externals, I can make sure that I have his most up-to-date work at any time.
Where To Go From Here
If you keep a repository of your configuration files, you could also keep script files in there, like perhaps a script which will create all of your etc symlinks for you :). You could also keep a copy of your firefox bookmarks in sync. The sky’s the limit.
August 3rd, 2007 at 8:18 am #Steven Hepting
Hey,
I actually do this too, and I *did* make a script to copy the config files to my home directory.
I keep my files in a Google Code project. “link”:http://shepting.googlecode.com/svn/trunk/configs/
Then whenever I’m on a new Linux (or Mac (or Solaris)) machines I can download this project, run “this script”:http://shepting.googlecode.com/svn/trunk/configs/setup.py and all my aliases and bash shortcuts are already there.
(I actually just updated the installer script today)
August 19th, 2009 at 6:01 am #QuickLinks vom 18. August bis zum 19. August — instant-thinking.de
[...] Using Subversion to Maintain your Configuration Files – Dipping into the topic, nice starter… [...]