Managing my personal knowledgbase with zettlr and git

Posted by Alex D'Andrea on 24 July 2024

Incited by a discussion on hacker news (which I don’t find any more right now) that evolved around the topic of how developers, or knowledge workers, can improve their productivity. There were several directions, but my main takeaway was that one just needs to write things down, no matter where, no matter how. The sheer act of doing it, of wrapping things up, ordering thoughts is what matters.

I used a physical notebook myself when I was team lead years ago, and that works well. However, today, I feel that I want a digital solution that’s always available where I work. It should be local, but synced remotely, so I could access it remotely and I have backup - and important - store plain text files on disk (markdown in this case).

I use zettlr for this. It does not have a sync option, though, but it is easy to construct one yourself: write a shell script that takes inotifywait input and combine it with some git commit -a ... and git push .... Or - use gitwatch that does all that.

When I start zettlr, I do that in a script that first launches gitwatch, then zettlr and when that terminates, it will also terminate gitwatch:

#!/bin/bash

gitwatch -s 60 -r origin ~/Documents/zettlr/ &
zettlr --ozone-platform-hint=auto

kill %1

gitwatch watches files in ~/Documents/zettlr, will collect changes in files for 60 seconds before wrapping them in a commit and then pushes it to the git remote named origin. Authentication works using the SSH agent I have running in background.

I have also just claimed ownership of gitwatch on AUR.