Honestly, this is what WordPress revisions should have been. In the age of git, there's no point in re-creating a versioning system that only covers elements of your system and not the entire thing. Just hook into git if it's available or even make a PHP implementation of git and use it.