git-autosave: Autosave your working tree to the remote
I came up with an autosave plugin for git. I've been developing a hobby of writing lately, and in my effort to allow myself to write and edit stories locally, I realized I would be missing out on the autosave functionality that Reedsy's editor provides. I tried using Syncthing for a while (and I still do), but I realized while working on another project that Git can probably do something similar with a plugin. Thus, git-autosave.
It works by having the daemon watch for edits to the repository, then creating a commit automatically. The commit is not put on any branch, but instead saved to refs/autosave/autosaves/<device id>/<branch name>. Running git restore-autosave fetches all of the references in that namespace from the remote, and merges an autosave from another device into your working directory. If there's more than one autosave available, then you are given the choice to select one. This is done without creating a new commit, so autosaves will not infect your commit history.
It's also fairly robust if you decide to work without an internet connection. Unpushed autosaves are stored in a queue, to be pushed when the computer regains internet. All repositories are pushed automatically when the device restarts.
I don't know how much maintenance I'll do to this system in the future, but I thought somebody might find it interesting, so I figured it was worth sharing.