Skip to main content

deconflict - help me solving sync file conflicts!

Interactive resolver for "conflicted copy"-style sync conflict files. Supports:

It's Pattern-driven and generic, so custom formats can be added via the config.

It is similar to the pacdiff for pacman. In order to be helpful with other file formats and not just plain text, it supports several viewers, editors, diff tools, and also extracts metadata (images, audio, video) and also shows metadata diffs.

Install

Clone this repo.

mise install             # a very convenient way to install `python` and `uv` 
uv sync                  # install python dependencies
uv tool install .        # install deconflict to PATH (or: instead of uv use `pipx install .`)

Usage

First you should create your config with deconflict init-config and then edit the generated ~/.config/deconflict/config.toml. Most likely you want to configure default_dirs so that you don't have to pass paths via CLI, and maybe you want also to set enabled_patterns.

Then you can simply do deconflict and resolve conflicts one by one.

Commands

TODO: check if complete and correct

deconflict                            # run `scan` and `resolve` andn start TUI (unless --no-tui)
deconflict scan                       # scan configured dirs, list conflict groups, exit
deconflict scan ~/Sync                # scan a specific dir recursively
deconflict scan --pattern nextcloud   # restrict to one pattern group
deconflict resolve                    # interactive per-group resolution
deconflict resolve --tui              # interactive TUI
deconflict resolve --auto newest      # non-interactive: base|copy|newest|bigger
deconflict resolve --dry-run          # preview without touching the filesystem
deconflict init-config                # write ~/.config/deconflict/config.toml
deconflict config                     # show active config
deconflict config tools               # show active config for tools
deconflict patterns                   # list recognized conflict patterns
deconflict --help                     # all commands & options

Patterns

group enabled matches
nextcloud on name (conflicted copy YYYY-MM-DD HHMMSS)
pacman on *.pacnew, *.pacsave, *.pacorig
syncthing on *.sync-conflict-*, *.sync-conflict-*-EXT
dpkg off *.dpkg-dist, *.dpkg-old, *.ucf-*
rpm off *.rpmnew, *.rpmorig, *.rpmold, *.rpmignore
windows-copy off * - Copy, * (copy)

Custom regex patterns go under [[scan.patterns]] in the config.

How conflicts are resolved

For each group you choose (menu adapts to the file type): (b)ase / (c)opy / (v)iew both files in the suggested app / (d)iff in terminal / (m)eld / (e)ditor / (h)keep-both / (s)kip / (q)uit / (?)tools. View opens both the base and the conflict copy in the app configured for that kind (editor, office, viewer, KeePass merge for .kdbx).

Losers are moved to a backup dir outside the scan roots (~/deconflict-backups/… by default) — never hard-deleted. A JSONL decision log records every choice. --dry-run never touches the filesystem.

Config

Run deconflict --init-config for a documented template at ~/.config/deconflict/config.toml. See config.example.toml. [file_types] maps each file kind (text, audio, image, video, office, kdbx) to the [tools] entry that (v)iew uses.

Auto-detected at runtime (never required): meld/WinMerge (visual diff), $EDITOR, eog/appropriate viewer, ffprobe (video), keepassxc-cli (KeePass merge), soffice (office docs), Kid3/Picard (mp3 tag editing).

Development

mise install      # python 3.13 + uv
uv sync           # .venv + uv.lock
uv run deconflict ...   # run the CLI
mise run check     # ruff check + format-check + pytest

Windows

Uses only pathlib operations; os.name branches select per-OS tool defaults; filename matching is case-insensitive on NT.

License

MIT

Release files for deconflict 0.2.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for deconflict 0.2.7
File Size Uploaded
deconflict-0.2.7.tar.gz 197.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for deconflict 0.2.7
File Interpreter ABI Platform
deconflict-0.2.7-py3-none-any.whl Python 3 none any Details

Total release size: 253.8 kB

Release files / deconflict-0.2.7.tar.gz

Download URL deconflict-0.2.7.tar.gz
Size 197.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a8fbca82490b48e0fb10465b328085ee2a93bfa3369faef4ee15cba56894e9ad
BLAKE2b-256 checksum
How to use checksums
4afa33e5d74298f0de49e12a124a0aabf8f1fa71785401e3224322f8cdcc6dbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / deconflict-0.2.7-py3-none-any.whl

Download URL deconflict-0.2.7-py3-none-any.whl
Size 56.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df42e34dfcb1713ecd9df9ef2f1296fd1294655d09d73887a84f598adff1259c
BLAKE2b-256 checksum
How to use checksums
6050c1368e2d002d5bbb6d4d74bdc8a55ddf84f27c17a8742f384128a01ccaaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.2.8

2 release files

This release

0.2.7 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page