WP Manifestindependent plugin directory
manifest / developer / git-reset

Git Reset

Reset WordPress installs and database using Git. This plugin will cause data loss. The POINT of this plugin is to cause data loss!

★ 1stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/pdclark/git-reset/archive/refs/heads/master.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Setup

  1. Prepare yourself. This is a plugin for test sites. When you run a reset, all your files and your database will be reset to your last Git commit. This will cause data loss!! DO NOT use it on sites containing critical or sensitive data!!!
  2. Install the plugin in WordPress
  3. Setup Git version control for your WordPress install. For example, git init; git add .; git commit -m "Initial commit";
  4. Set up your WordPress install however you like, then run Reset > Update Defaults in the admin bar.
  5. Verify your server allows access to PHP exec(). One good test is that if the plugin doesn't work, your server doesn't allow it. ;)
  6. Add this to your .htaccess file:
# Deny public access to .sql files.
# Claim File Not Found instead of "Forbidden" so file existance isn't revealed
<Files ~ "\.sql$">
    Order Deny,Allow
    Allow from all
    Satisfy All
    Redirect 404 /
</Files>

Usage

Any time you want to reset WordPress back to your default files and settings, select Reset > Reset WordPress in the Admin bar.

Any time you want to update to new defaults (make a Git commit and database dump), select Reset > Update Defaults in the Admin bar.

Undo the last Git commit, but keep file changes (command line):

git reset --soft HEAD^