# Manage Configuration Changes with Git

This content was originally written on the OpenNMS Discourse forum (see Managing Configuration Changes with Git).

If you want to manage your configuration files with Git but haven’t used it for version control before, GitHub’s Using Git tutorial covers the basics. You can also read Developing with Git on the OpenNMS Discourse forum.

If you have an existing OpenNMS Horizon installation, check for the `etc-pristine` directory. If your Horizon environment does not have this directory, you will need to upgrade to a version that does.

 Remember to stop Horizon before changing files in the `etc-pristine` directory.

## Start with a pristine `etc` directory

• Debian OSes

• Other OSes

 `$OPENNMS_HOME/etc` is linked to `/etc/opennms`. Do not move that folder. Moving the folder will break the link and cause future upgrades to fail. Run the following code to prevent breaking the link between folders: ``````cd /usr/share/opennms mv etc etc_bad ln -s /etc/opennms etc`````` Run the following code to move your customized configuration files to `/etc/opennms.bak` and replace them with the contents of `etc-pristine`: ``````mv /etc/opennms /etc/opennms.bak cp -pR /usr/share/opennms/share/etc-pristine /etc/opennms`````` Run the following code to move your `$OPENNMS_HOME/etc` files to a safe place, then copy `etc-pristine` to the `$OPENNMS_HOME/etc` directory: ``````mv$OPENNMS_HOME/etc $OPENNMS_HOME/etc.bak cp -pR$OPENNMS_HOME/share/etc-pristine $OPENNMS_HOME/etc``````  On RPM-based installations, the pristine configuration files are located in `$OPENNMS_HOME/share/etc-pristine`.

## Initialize Git

Run the code below to turn your `etc` directory into a Git repository and add the pristine files as your first commit:

``````cd $OPENNMS_HOME/etc git init cat << EOF >$OPENNMS_HOME/etc/.gitignore
foreign-sources/
imports/
examples/
include
*.dpkg-old
libraries.properties
pluginManifestData.xml
org.opennms.features.datachoices.cfg
include
configured
EOF
Replace the `x.x.x` in the last line with your current Horizon version.