<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="atom-style.xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
    <id>https://corion.net/blog/tag/tools/</id>
    <title>Corions Musings</title>
    <updated>2026-05-31T00:00:00Z</updated>
    <link href="https://corion.net/blog/tag/tools.atom" rel="self" />
    <link href="https://corion.net/blog/tag/tools/" rel="alternate" />
    <generator version="0.098">Statocles</generator>

    <entry>
        <id>https://corion.net/blog/2026/05/31/automating-some-file-history-with-git-snapshots/</id>
        <title>Automating some file history with git snapshots</title>
        <author><name>Corion</name></author>
        <link href="https://corion.net/blog/2026/05/31/automating-some-file-history-with-git-snapshots/" rel="alternate" />
        <content type="html"><![CDATA[
            <p>My <a href="https://github.com/Corion/App-notes-htmx">Note taking tool</a> is part journal, part shopping list, part blog posts, part programs. Most notes get written once. Some get revised, some get posted or implemented.
The tool is fully self-hosted and written by me, so I get to decide on its (lack of) features.
For simplicity I avoided keeping a full note history. But then I realized that maybe some kind of history
is actually nice, for the case when a wonky network failure erases or corrupts some note.</p>

<p>My solution for this feature is to simply snapshot the directory where I keep my notes every hour into a <code>git</code> repository. This
gives me some change history, but it does not record every keystroke. The <code>cron</code> job is the following shell script:</p>

<pre><code>SOURCE=/home/corion/bin/App-notes-htmx/notes_corion
TARGET=/home/corion/backup/notes_corion_history
if git --git-dir=$TARGET --work-tree $SOURCE diff --quiet; then
    git --git-dir=$TARGET --work-tree $SOURCE add  --all
    git --git-dir=$TARGET --work-tree $SOURCE commit -m &quot;Hourly&quot;
fi
</code></pre>

<p>I&#39;ve &quot;implemented&quot; the tool as a shell script, but if I add more features, I will likely move it to Perl and use <a href="https://metacpan.org/pod/Git::Raw">Git::Raw</a>
to do the adding/filtering/pruning myself. But then I would lose the convenience of <code>.gitignore</code> for example.</p>

<p>I still have on my list some kind of <code>git history-prune</code>, that coalesces adjacent git commits if they are too close, just
to eliminate changes that don&#39;t matter anymore. Maybe
after a month, compress all commits older than one month and less than 24 hours apart into a single commit.</p>

<p>I think having all changes of a single day in one commit is a sensible granularity for my use case.</p>


                <p>Tags:
                    <a href="https://corion.net/blog/tag/tools/">tools</a>
                </p>

        ]]></content>
        <updated>2026-05-31T00:00:00Z</updated>
        <category term="tools" />
    </entry>
</feed>

