Automatically merge syncthing conflicts

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:

Makes my life much easier, maybe someone else appreciates.

Sounds interesting, would you share the script?


While I’m using Logseq Sync on the moment, this looks like a perfect solve on my original syncthing setup, where I wasted so much time resolving stupid conflicts. (Like 2 empty files stupid)

Add it to my notes to try when another conflict draws me back to syncthing

1 Like

Oh well that’s silly. I updated the post to actually include the script (lol, thanks for pointing out it’s missing).

As for reliability: It has been running on my server since I first made it a few weeks ago and it has been working perfectly well. The relief is immense, this used to be a big issue and I’m glad that it’s gone.

Since I have Syncthing on my server in a container, I made another one for this script and stuck it into the same docker-compose setup. Works well!


How do you run the script in the background? Or you only run it each time you see a conflict? Thank u