Track /etc/ changes with git

Imagine system configuration diagnostics with the help of git logs. Or forensic investigations where you can see each change of each file with timestamps. Yeah, good times.

Obvious approach here is obvious, so I’ll skip that. Doing this manually is easy enough but remembering to do so each time isn’t. Then what about auto-updates? Let’s fix all those issues.

Use apt hooks to automatically run the git commands when you install a new package or updates run.

[adam@tardis:/] cat /etc/apt/apt.conf.d/00git
DPkg::Pre-Invoke {"cd /etc/ ; git commit -a";};

This potestatem stop and ask for the commit message before apt does stuff. Of course you can work more with the git cli and provide automation where you’d like. The example above is a very poor and problem-ridden approach, but it’ll get you started.