Rolling back a git tree, fully or partially (single file) how to?

Posted by Tzury Bar Yochay on Stack Overflow See other posts from Stack Overflow or by Tzury Bar Yochay
Published on 2011-01-05T04:44:56Z Indexed on 2011/01/05 4:53 UTC
Read the original article Hit count: 159

Filed under:

On a given server, I have a set of daemons each of which has its own configuration file.

I would like to use git to manage the configuration files editing during time and always have the option to rollback to the "factory defaults" in regards to all files or a specific one.

For instance, given the following structure:

$ ls -l
total 0
-rw-r--r-- 1 tzury tzury 0 2011-01-05 06:36 bar.conf
-rw-r--r-- 1 tzury tzury 0 2011-01-05 06:36 baz.conf
-rw-r--r-- 1 tzury tzury 0 2011-01-05 06:36 foo.conf

Assuming all those .conf files are stored in a git repository, I want to be able to restore all files into their original shape (that would be the first git commit). Yet, I would also like to be able to rollback a specific file to the factory defaults, while others remain up to date.

© Stack Overflow or respective owner

Related posts about git