Mastodon Lutra IT Tech blog – Synchronising files with Unison

Synchronising files with Unison

Posted on za 24 oktober 2026 in 2026

If you need to copy a lot of data from A to B, in an incremental way, rsync is a very well tested solution. I've been using rsync since I don't know when but very probably since the last millennium. And by using I mean doing proper data migrations in production environments for organisations. #dinotalk

There is a very less well known tool that also can keep data in sync, but in a bidirectional way. It's called unison and development started in the late nineties. Also #dinoware. I was using unison on a daily/weekly basis around the turn of the century. It always worked great for me, but when tools like Dropbox, iCloud drive and Nextcloud came along over the years, I could not find a sane use for unison any more.

The only time I miss unison, is when I actively develop code on multiple machines at the same time. Sure, all my code goes through git. But keeping all your git repositories clean and organised enough with WIP branches etc, it is just not something that I can make happen. Of course proper finished code is pushed on a branch, pipelines are run etc. A lot of days I have some state in a local repo that is not ready for proper pushing/sharing via git yet.

But I still want to switch devices without losing any state. So the git repos on laptop one need to be synced to laptop two.

Rsync can help, but you still need to remember what way to sync or risk losing recent progress. This for sure never happened to me and is a purely theoretical problem :-). Syncing git repositories using Nextcloud, Synology Drive client or any other tool I tried was a great way to drive these tools in the ground. All the small files, all the ignore dotfile magic. It is really not what these fine tools were designed to do.

So today I went to look for unison and it is still alive. It has moved to github, but some development activity is still there. So it seems there are still people using and maintaining it.

When installing the tool, it is worth mentioning that it can be picky about versions. So I installed it using homebrew on both my MacBook and my Debian laptop, ensuring I have the save version on both sides.

It must be said, the tool goes way back, so the command line options, the documentation etc are all nineties work. Solid, complete, but a bit arcane by today's standards. I checked the getting started guide, and I was happily two-way syncing my git repositories directly between two laptops over ssh within no time. I created a couple bash aliases, so I don't have to memorise any syntax.

alias codesync-source="unison Documents/source ssh://eelco@odin//Users/eelco/Documents/source"
echo "To sync code between laptops run codesync-source" 

If you ever feel to need to directly synchronise stuff, go check it out.

Oh and just to be sure: always have recent backups when trying/using tools like this!