<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="rss-style.xsl"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Corions Musings</title>
        <link>https://corion.net/blog/tag/tools/</link>
        <atom:link href="https://corion.net/blog/tag/tools.rss" rel="self" type="application/rss+xml" />
        <description>Blog feed of Corions Musings</description>
        <generator>Statocles 0.098</generator>
        <item>
            <title>Automating some file history with git snapshots</title>
            <link>https://corion.net/blog/2026/05/31/automating-some-file-history-with-git-snapshots/</link>
            <guid>https://corion.net/blog/2026/05/31/automating-some-file-history-with-git-snapshots/</guid>
            <description><![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>

            ]]></description>
            <pubDate>
                Sun, 31 May 2026 00:00:00 +0000
            </pubDate>
        </item>
    </channel>
</rss>

