Put Your Rc, Config Files and More Under Source Control
I’ve been working on more and more computers lately, and I was getting tired of my favorite bash and editor shortcuts not being available between the different machines. I finally took some good advice I heard a while back and put my config files under source control, and it’s been one of the best tips I’ve followed in some time.
The way I’ve done it is to use GitHub to store my config files, so anyone else is free to take a look if they want to see how I’ve got vim, bash, screen, readline, ruby’s irb or other things configured. However, the biggest benefit is that I can quickly get a new machine customized with all my favorite settings just by doing a checkout (clone in git) into my home directory on the new machine. From there I’ve got a little script I run called ‘create_symlinks’ that backs up the old config files before overwriting them with symlinks that point to the files in my checkout. That way, whenever I update my repository, the files are automatically current.
This has been immensely helpful in taking the tricks I learn at work and easily incorporating them at home or on any remote server I have to do work. If I add something new and cool to my vimrc at work, I just have to remember to commit it and push the changes to GitHub before I head home, and then I can continue working from home without having to remember whatever command I just automated.
I’ve even heard of people who go so far as to put their whole home directories under version control as a way of not only moving files around, but as a way of doing backups. That seems overkill to me, but it’s worth thinking about what sorts of files we move around a lot might be easily moved and backed up using a source control system like git or SVN.