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/bash_profile ~/.bash_profile
. 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 to 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.
Comments
comments powered by Disqus