etckeeper

From wiki

etckeeper is a program that will keep the content of the /etc directory in a git repository. It allows to check history of config files in case you need it later.

Install

$ sudo apt install etckeeper

This will install and configure etckeeper.

For more information, check the official README.