Zend certified PHP/Magento developer

Tool to facilitate using hard links for versioning a large directory

I have a relatively large data directory. It gets updated occasionally, but usually only a small percentage of the tree changes. I’m currently updating it by using cp -Rl previous_version/ new_version/ to recursively create hard links in new_version/, then I go into new_version and manually update the files that have changed. This is very space efficient, but tedious and I have to be careful to replace updated files with new inodes. If I accidentally modify the files it will change the previous versions.

What I’d really like is to be able to construct a new directory updates/ that only has the updated versions of whatever files have changed, then have a hypothetical tool that I can run like this:

some-tool previous_version/ updates/ new_version/

What some-tool would do is construct new_version/ using hard links from previous_version/, then for each file in updates/ it would replace the existing file in new_version/ with a hard link from updates/.

This would allow me to more easily and safely do what I’m doing, as well as provide nice update directories that clearly show what has changed between each version.

Does such a thing exist, or is there maybe another way to solve my problem?