I am trying to find a solution to a very difficult task: properly version controlling WordPress, specifically when working with automatic updates.
WordPress allows a lot of simplicity by allowing users to update WordPress core files, themes and plugins by simply clicking a button. But what happens when you have that website under version control with something like Git? As soon as we click that "Update Now" button, our Git repo will be out of sync and therefore defeats the purpose of creating a Git repo in the first place.
I have been looking into ways to get around this issue and all I was able to find was different ways to structure the Wordpress installation by breaking up components into Git submodules. One of the most popular example is the WordPress-Skeleton template.
Although this works to version control each module / component of WordPress, it still does not allow the user to be able to use the automatic updates button from within WordPress, as that will update the files in production but not commit those changes into your Git repo.
In an ideal world, we should be able to version control all the files in one repository and then when we click the "Update Now" button, it should update our Git repo with the modifications automatically. Does anyone know how this can be accomplished?
One of the things I was thinking was to create a plugin that would listen for update events and automatically commit changes as soon as that hook is triggered. Not sure if this is the best approach.
Please let me know if anyone has a better way I can accomplish this.