I started to keep a loose log of todo’s and related useful information at work. This log is a simple text, file which I use in a append-only fashion. New information gets added at the top, using markdown notation.
Our company provides we with a Google Account, so I put my notes into Google Drive to back it up. You can choose Dropbox or a private git repository for hat matter.
But having just a plain file, makes it hard to keep track of when an entry was made. So I started to use git to take care of the versioning for me. I still keep my files in Google Drive and do not push the git repository, because I’m only interested in the versioning, and not in collaboration of backup.
However I would like for commits to happen on a regular basis instead of me having to remember to also make a commit after changing a file.
Since the usage of cron is discouraged on mac I looked into using apples
Launch Control works by loading job descriptions from
.plist files, which
are noting more than xml files, which are easy enough to write my hand.
You will find your Launch Control files in
Here is the plist file I use for my notes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
WorkingDirectory sets the working directory for all the program calls, which
makes it very convenient to write out the necessary git calls.
WatchPaths defines an array of path to watch for changes, which is a
perfect fit for my notes versioning problem, because it facilitates the triggering
of commits every time I save, but not during the long hours I might not change
anything at all.
ProgramArguments is essentially the command line call separated in its components.
I’m simply adding all the changed files and create a commit with a fixed message.
You will obviously have to have your notes directory initialized as a
If it also contains files that you do not wish to have included I would recommend
adding them to a
To actually register this job and have Launch Control run it you have to load
launchctl load velrok.gittify-notes.plist.
To stop execution of your script you need to unload it
launchctl unload velrok.gittify-notes.plist.
Now you should have your git versioned directory of plain text notes
running and the launchctrl daemon trigger new commits every time you save
your notes file. There is a slight delay of a couple of seconds between the
save and the actual commit. Just run “git log” in your notes directory to see
a log of commits.
A call to
git blame notes.md will show you the file contents with
time stamps next to each line, so you know, when they changed last.