Version Control in your /etc
16 August 2007One common mistake is to think that version control is just for developers. As long as you are working with text, you’ll love the possibility of checking your changes and going back in time.
Two are the main models of Version Control: centralized and distributed. In the centralized world you have CVS, SVN or Perforce; in the other hand, you have GNU arch, bzr or git.
Nowadays, distributed systems seem to be the way to go, unless is a requirement to have all the code base in one place (and for some companies that requirement exists).
- Branching and merging is cheaper than in any centralized option, and usually more reliable.
- No need to go through the network to perform any basic operation. And that includes commits.
- Every copy is a full backup of the repository *
So, let’s go for it. I just bought a second hand computer from my university, and yesterday I was installing Ubuntu on it. Despite the fact that Ubuntu gives you almost everything out of the box, my geek mind cannot avoid fiddling in the /etc. So my plan is (in a bright geek moment) to use revision control for my /etc directory. Here we go:
ubuntu:~$ cd /etc ubuntu:/etc$ sudo bzr init ubuntu:/etc$ sudo bzr ignore * ubuntu:/etc$ sudo bzr add fstab apt/sources.list ubuntu:/etc$ sudo bzr ci -m "Initial import"
OK, we got our own full-fledged bazaar repository. I just ignore all the files to add them explicetely (well, I don’t care about a lot of the files there). And we have even committed our first revision. Ain’t nice? : ). Now you can go fiddling those files: you will always have a backup, and when you do further modifications a versioned and commented backup will cover you. To be short, all the niceties of version control are there, enjoy them:
ubuntu:/etc$ sudo bzr log ------------------------------------------------------------ revno: 6 committer: root root@gerard-desktop branch nick: etc timestamp: Thu 2007-08-16 18:14:33 +0300 message: - NTP user (apt-get) - Skype repository ------------------------------------------------------------ revno: 5 committer: root root@gerard-desktop branch nick: etc timestamp: Thu 2007-08-16 00:20:14 +0300 message: - Removed apt/apt.conf.d/ (Ubuntu update-manager thingie) ------------------------------------------------------------ revno: 4 committer: root root@gerard-desktop branch nick: etc timestamp: Thu 2007-08-16 00:15:45 +0300 message: - Change in apt/preferences to get apt-get -t working ------------------------------------------------------------ revno: 3 committer: root root@gerard-desktop branch nick: etc timestamp: Wed 2007-08-15 22:37:08 +0300 message: - group added to revision control ------------------------------------------------------------ revno: 2 committer: root root@gerard-desktop branch nick: etc timestamp: Wed 2007-08-15 22:01:00 +0300 message: - VirtualBox deb repository - Removed *.gpg binary files from revision control ------------------------------------------------------------ revno: 1 committer: root root@gerard-desktop branch nick: etc timestamp: Wed 2007-08-15 21:42:43 +0300 message: * Initial import of global system configuration - Added some common files - fstab tuned (noatime) - EDITOR="vim" for bash sessions
Leave a Reply
You must be logged in to post a comment.
One Response to “Version Control in your /etc”
August 17th, 2007 at 2:09 pm
Per fi un poc d’activitat! Els dos últims articles molt útils (en especial l’anterior… sembla interessant la utilitat. Jo fa poc que m’he instalat el Debian…).
Salut!