Git/tracking-etc
From Gentoo Wiki
< Git
Jump to:navigation
Jump to:search
Tracking the /etc directory with git is a common procedure within the Gentoo community - although tools exist to solve configuration file change management.
Quick and dirty
The gist of dirty configuration file management with git is as follows:
- Change to the /etc directory:
root #
cd /etc
- Initialize a new git repository:
root #
git init
- Commit initial the initial state and any further known good revisions:
root #
git add * # add all files not in git to the .gitignore file
root #
git commit -m 'required'
- To investigate revisions:
root #
git rev-list #display all revisions
- To checkout/load a specific revision:
root #
git checkout #<(insert a revision hash here>
- To revert unwanted changes:
root #
git reset --hard # undo all changes from revision checked out
- Alternatively:
root #
git reset
root #
git checkout .
See also
- etckeeper — a collection of tools to store /etc in a VCS (version control) repository, to keep a backup of changes to system configuration files