Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am after a tool that can provide me with incremental file history (for text-ba

ID: 658419 • Letter: I

Question

I am after a tool that can provide me with incremental file history (for text-based source files). I use version control but would like more history.

This history only needs to be temporary and span the gap between commits. Sublime already lets me diff the editor contents to what is saved. So I would like get a change record per save.

Many IDEs have this feature. For example IntelliJ's local history. However I would like to do this independent of an IDE or text editor. I am after a dedicated tool that can run on Linux.

One approach would be to use rsync and periodically take backups. There are even tools that do this such as tym. But this would make it difficult to search through the list of changes. I would like something that has a Git style history and can use a Meld style interface to diff changes.

Explanation / Answer

The way to do keep versions of files automatically and independently from the application is at the filesystem level. There's a FUSE filesystem for that: copyfs. Copyfs provides a view of an existing directory tree (stored on the filesystem of your choice) where all past versions of each file are kept available. Opening files normally yields the latest version; the command line tool copyfs-fversion lets you access past versions.

To compare a past version with the current version, run copyfs-fversion -l VERSION-NUMBER FILE to lock the old version, make a copy of it, then run copy-fversion -r *FILE* to return to the latest version. There's also at least one patched version, fuse-copyfs, which extends copyfs-fversion with an option -d to diff versions (among other things).

Copyfs lacks a way to purge old versions.

Alternatives (also based on FUSE) are mentioned in Linux File Versioning? on Unix & Linux.