Tracking changes within notes. Review changes on a specific time period (day, week, etc.)

Continuing the discussion from Track file changes - get a list of file edit dates:

What I’m trying to do

I want to review what I did in Obsidian in terms of edits in notes recently. I would like to see more than which notes were created and edited in a specific period (day, week, etc.)
I’d like to have a similar view, somehow like on GitHub, to see what changed. Seeing which content was created/edited/deleted where and when is what I need.

Example here on Obsidian Help Github.

Things I have tried

Presently, I implemented modified date and created date properties as described in this comment

However, this is somewhat a larger view and doesn’t tell what were the changes actually.

I need that to be able to report on knowledge acquired on a specific period.

I feel like all the data already exists thanks to Obsidian Sync, as there is a sync log on every note. See screenshot on top that shows what Obsidian Sync know exactly.

With the exception of actually tapping into the Sync log, this information is simply not available by default setup.

You could consider setting up git towards your vault, with some form of regular auto commits. Then you would be able to exactly see what changes are made and at what time.

Yes, I know about that.
My purpose is to support a use case, see if some more people are also interested.

It has to be noted those logs could be made available through API as they already exist hidden somewhere. This would unlock some community plugin development potential as well.

I would rather not use Git as I am syncing on multiple devices, including mobile. Conflicts would also add up to the general complexity of that approach.

I approach this by keeping a log at the bottom of notes (mainly for media and project notes, but I’m doing it more in other notes too now). What you’re proposing has some appeal to me but realistically I would probably not use it regularly.

(Related but not the same: I’m generally interested in having a history of my notes — especially projects — and would love to have some kind of simple version control where I could select versions from the general stream of changes to save for posterity. As I recall there’s a Plugin Idea post looking for something like that.)

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. :smiley:

I must remind that there could be an other way than using Git.
Obsidian Sync service already keep track of file versions with it’s own system and it seem to be quite reliable. But this is internal and not exposed in the API. This is already implemented on desktop as well as mobile devices which is a greatly appreciated for my usage.

My only regret is that we can only access it one note at the time.

I’d still love to find something more basic (like, I don’t even need branches for this, let alone girls other myriad features), but yeah, this is probably what i’ll end up doing. I’d do command-based because the whole point for me is having more meaningful commits. Obsidian Sync ignores hidden files, so I wouldn’t have to worry about moving the cache. The “one device only” idea is helpful — I hadn’t considered that. I could do it on my phone (so I can always update it if I realize i’ve forgotten), and occasionally pull a copy to a non-vault location on my laptop for further backing up.

Yeah, for your use case, access to this would be very handy. (For mine, Sync’s limited history would be a problem.)

Have you looked at the Version History Diff plugin? I think it’s also one note at a time but might be a little more convenient; in any case, it shows that a plugin can access that stuff (at the cost of possible future breakage because of private API changes).

1 Like