We use WPEngine to host WordPress sites and push changes via Git to a staging version of the site – these can then be deployed to the production version via an internal script.
We staged the live site a few days ago and pushed up a number of changes via Git to the staged version.
Accidentally, one user pushed the button to recreate the staged version of the site and all our changes were lost – Git thinks that the local and remote are up-to-date – but of course, the staged version now shows the files in the form they are on the current live site.
Is there a way that we can force push up commits from the last x days or between two set hashes – or some other correct way to notify Git that the changes are no longer in sync?
Thanks!
git push <remotename> <commit SHA>:<remotebranchname>
should do the trick, provided<remotebranchname>
already exists on the remote. If it doesn’t, usegit push <remotename> <commit SHA>:refs/heads/<remotebranchname>
Note that this pushes all commits up to and including the commit you choose. If you don’t want that to happen, you should first use
git rebase -i
to re-order the commits.Note: Picked this from thread on SO : git – pushing specific commit. Check it out for more details.
I have had a similar issue when I have had to restore a site from a backup on WP Engine. What works for me is to just change something in a file.
This should make sure everything matches local, adding/deleting/changing where needed, not just the last commit.