etckeeper is a collection of tools to let /etc be stored in a git, mercurial, darcs, or bzr repository. It hooks into apt (and other package managers including yum and pacman-g2) to automatically commit changes made to /etc during package upgrades. It tracks file metadata that revison control systems do not normally support, but that is important for /etc, such as the permissions of /etc/shadow. It's quite modular and configurable, while also being simple to use if you understand the basics of working with revision control.

etckeeper installation:
Open your terminal and type following command to install etckeeper:

sudo apt-get install etckeeper

After the installation etckeeper will add all the files under /etc into its default repository (bzr), The main configuration file, /etc/etckeeper/etckeeper.conf, is fairly simple. The main option is which VCS to use. By default etckeeper is configured to use bzr for version control.

Configure etckeeper:
Open /etc/etckeeper/etckeeper.conf in your favorite text editor. The first option that you need to look at is VCS, which is the version control system you want to use. By default it’s set to bzr, but you can change it to other depending on your preference.

Another option that you may want to look is AVOID_COMMIT_BEFORE_INSTALL. By default, etckeeper will automatically commit any pending changes when you install packages. You can disable it by setting AVOID_COMMIT_BEFORE_INSTALL to 1. Also set AVOID_DAILY_AUTOCOMMITS to 1 for avoiding daily auto commit.

Using etckeeper:
First create a repository for etckeeper using following command: