With our Git Push to Deploy system, you can keep your entire website in a version control system and effortlessly push changes without needing to mess around with SFTP. However, you might come to the point where you find that you need to delete your entire current repository and start anew.
Resetting your Git Push repository on WP Engine is actually a very simple process. Before we get started, please note that if you do this, there is NO undo. Support will not be able to come in and restore your Git repository to a previous state. You must be absolutely sure that deleting your entire repository is what you really want to do before continuing.
Here’s an outline of the steps involved:
- Initiate a new repository on your local computer
- Force push the new repository to WP Engine
- Continue using Git Push as before
Initiate a new repository on your local computer
If you’re reading this article, you should already be fairly familiar with how Git works. Of course, if you’re still new to Git and aren’t as familiar with initiating a new repository, you can reference the Getting Started page for Git Push to Deploy. Here is the most important portion:
cd ~/wordpress/my_wordpress_app
git init .
git add . --all
git commit -m "initial commit"
If you’re looking to have an entirely blank repository put into place instead of starting with previously created site data, this will not be possible as Git requires the tracking of at least one file to push content over. Creating a blank text file with a name of your choosing (“blank_file.txt” for example) will allow you to clear out the data within the Git Push repository on our end.
Force push the new repository to WP Engine
We have set up our Git Push system to allow you to set up a new repository as needed. When you go to push to our servers, you slightly modify the command to tell Git to force the push. If you are pushing to production, the command might look like this:
git push -f production master
Source
You should get output that looks similar to this:
Continue using Git Push as before
Now you should be able to keep using Git push exactly as before. You can make new commits and push them. After the first push, it is no longer necessary to use -f in the push command.