I’m thinking that the best approach for something like this is indeed git
. However, I’m thinking using git
on one device, and care should be taken not to sync the git cache to other devices. I.e. Given /folder/MyVault/
, the git folder should be at /folder/.git/
and not /folder/MyVault/.git/
.
Three scenarios on how/when to commit
With that in being I’m contemplating on three different scenarios which would be feasible to implement.
Time-based commits
Set up a scheduler to commit any changes to the vault at given time intervals, like once every hour or so. This would ensure you always get changes committed, but you don’t get to insert any commit messages to describe the changes made. This is most likely the base of the git plugin, which I’ve not used myself (although that is to a remote repository).
Based on file modifications
It’s theoretically possible to setup some system to detect when you change files (and more importantly stop changing it again), and then post a commit of that file possibly with asking you for a commit message. But to do this reliably is something else. Even Dataview which been around the block for a while, have every now and then cache issues related to not detecting when a file has changed (and stopped changing) to trigger a correct refresh.
Command based commits
The easiest solution though once you’ve setup a git repository (locally or remote), is to have a command to trigger a commit of the current file. This would easily allow you to prompt what this change was about, and you could now control when you do a “critical” or “noteworthy” change to your note. This scenario would also allow for you to commit just the notes you wanted to track changes of.
This could also be combined with having a global command for a full “backup” of your vault into git. Which would be very useful for many users.
What can be achieved using git
Given a git based repository, you can then rather easily create logs of what happened with any particular file, and these are following such given formats, that it’s very feasible to imagine build a list of changes where one could use callouts to list actual changes, or just listing the commit messages and reviewing either version of the note in question.
If one is so inclined extra commands related to restoring/patching a note related to the history is also availabe, but I’m thinking especially stuff like git whatchanged -p some/file/name.md
or git log some/file/name.md
would be the most interesting to achieve what’s been asked for by the OP.
NOT using git
In essence if you’re not using git, you would still need to keep track of every version, at some given time interval, in order to track the changes. And if not doing this is in the very rudimentary variant of copying the entire file every now and then, you’re very soon trying to resemble what git has a well built (and efficitent) system to do.
All in all, I do believe the way forward would be to use git, most likely locally (and outside of the vault) on one device, to achieve functionality like what has been asked for. Any other means, I’d consider as attempts to reinvent the wheel. 