You could use a md5 hash to check if the file has modified or not. It is much more accurate and safe than only using a diff. In addition, using the MD5 hash will make the storage for the file much smaller..
*someone said to use "HEAD", to check the last modified date. This value is not safe/trustworthy.