Java Properties can be conveniently loaded and stored into a file on a local system. Every time the Properties are stored, the file is completely overwritten without an option to version the changes. Here is a simple implementation of Git-based store to trace all changes to a given Properties file.


GitPropertiesStore store = new GitPropertiesStore(System.getProperty("") + File.separator + GitPropertiesStoreTest.class.getSimpleName());

// Store
Properties testProps = new Properties();
testProps.setProperty("hello", "world");"", testProps);

// Read
Properties storedProps = store.get("");
storedProps.getProperty("hello"); // "world"

Source Code

Check out the source code on GitHub

Leave a Reply

Your email address will not be published. Required fields are marked *