I don’t always have a perfect internet connection for multiple reasons (German trains, device is off, Wifi is disabled on the E-Reader to save power), so I used to have a lot of conflicts when using Syncthing, which I found super annoying, because often it would look like a data loss (it’s better now that conflict files are shown in Logseq itself, but still annoying) - all the stuff I had written on the train would just be gone.
So I built a little script based on Automatically resolve Syncthing conflicts using a three-way merge · Rafael Epplée that automatically detects conflicts and merges the corresponding files.
Finally no more .sync-conflict files scattered around the place! Since the sync-conflict files are just normal files that are synced, the conflict resolution can be done on one device and is synced over automatically. I have been stress testing it a little and it has held up very well.
There are a few assumptions:
- Git is installed on the machine the script runs on
- Versioning is enabled (I use staggered versioning)
- The script is running inside the (base of) the Logseq folder
Now instead of sync conflicts/apparent data loss, the worst thing you’ll get is duplicated nodes.
Here it is: syncthing-automerge.py
Makes my life much easier, maybe someone else appreciates.