As a developer and Linux-user, I continuously change several configurations in my systems, some of the changes can include:
- Port-based services: When you have several web servers working on the same machine, you have to configure ports and alias addresses.
- Package sources: I just don't want to mess my apt-get and slapt-get sources configuration.
- Security: External services configuration, security configurations and system restrictions.
- Run levels: I like to have the services I use at system startup, the other ones can burn in hell...
- Networks: I have some static configurations for some environments.
- X11: For some custom modifications I made for several displays.
- Databases: Sources, ports, users and some other configurations.
- Cron: Some backup and maintenance jobs.
- Revision control systems: Common filters, aliases, etc.
Because of the situation, I needed these things:
- Keep snapshots of my configuration files.
- Rollback changes.
- Restore old configurations.
- Check which files/lines where changed.
- Use it all from the shell.
My choice? Git, it is obvious that its shell interfaces are superior compared with Mercurial, it's very well integrated with all UNIXes and I have been working with it for a long time.
So, whenever I want to check if a configuration has been changed:
#> git status
What about reverting a change?
#> git reset -HEAD
And if I want to restore it to its initial version?
I just modified a bunch of files, save a snapshot of them:
#> git ls-files --modified | xargs git add
#> git commit -m "Too much work and no fun makes Jack a dull boy..."