Restore configuration files from Git revisions

This command restores configuration files from the Git repository under /etc/.git. The required --target flag controls where files are written. If the target is /etc, restore will happen directly into the live working tree. That is often the most useful mode when /etc is clean and committed, because you can move to an older revision, test or inspect it, and then restore the newer revision again while keeping the benefits of revision control.


This command was previously named restore-config-backups. If you see the older name in changelog entries or examples, use restore-config-revision instead.

If the target is any other directory, files are written into date-stamped subdirectories instead. This is mainly useful when you want exported copies outside the live tree, or when you need to inspect revisions on a system where /etc is not clean.

Use --module to limit the restore to a single Webmin module. When a module is selected, each --file value is treated as relative to that module directory. Without --module, file paths are treated as relative to /etc, unless an absolute path is given. The --file option may be repeated for multiple files or directories.

By default the command restores only the most recent revision. With --depth, older revisions are also considered. When restoring to /etc, only the oldest revision at the selected depth is applied. Use --dry-run to preview what would be restored before writing any files.

Examples

Restore the latest Virtualmin module revision into a separate directory for inspection:

virtualmin restore-config-revision --module virtual-server --target /root/config-revisions

Preview restoring the last five revisions of the main module config file:

virtualmin restore-config-revision --depth 5 --module virtual-server \
                                   --file config --target /root/config-revisions --dry-run

Restore the main module config file from ten revisions ago directly into /etc:

virtualmin restore-config-revision --depth 10 --module virtual-server \
                                   --file config --target /etc/

Command line help

virtualmin restore-config-revision --target <dir> [--dry-run]
                                   [--depth <n>]
                                   [--file file]*
                                   [--module module]
                                   [--git-repo </path/to/.git>]