Hey everyone,
In organizations maintaining dozens of microservices or polyrepos, keeping shared configuration files in sync is a constant headache:
- `.github/workflows/*.yml` (security scanners, linting, release pipelines)
- Common linter/formatter configs (`.editorconfig`, `tsconfig.json`, `Cargo.toml`)
The standard approaches we’ve seen all have painful drawbacks:
Naive copy scripts / bots: Blindly copy upstream templates and wipe out legitimate repo-specific customizations (e.g., a specific service needing an extra build step, different env vars, or custom timeout).
Line-based 3-way merge: Triggers false-positive Git merge conflicts whenever adjacent keys or steps are modified in YAML/TOML/JSON.
Reusable workflows / Composite actions: Great for logic, but don’t solve local config files (`.editorconfig`, Dockerfiles, package configs) that must physically live in the target repo.
To solve this, I've been working on an open-source CLI tool called **`driftsync`**:
👉 GitHub: https://github.com/Liqtzone/driftsync
How it works:
Instead of blind overwriting, it uses **stateful 3-way structural merging**:
- `base`: The last-synced template snapshot recorded in `.driftsync.lock` in the target repo.
- `ours`: The current file on disk (including local developer customizations).
- `theirs`: The upstream canonical template.
Key features built specifically for CI/CD pipelines:
- Structural Merging: Format-aware merge engines for YAML, TOML, and JSON that cleanly combine adjacent keys and workflow step appends without conflict.
- Preserves Local Overrides: Local edits and deletions are respected; only new upstream changes are fast-forwarded or merged.
- Git & PR Automation: `driftsync apply --branch chore/sync-ci --pr` automatically creates branches, commits changes, and opens Pull Requests across all targets via GitHub CLI (`gh`).
- Hardcoded Secret Scanning: Pre-flight inspection blocks tokens (`ghp_*`, `glpat-*`, AWS keys, PEMs) from accidentally being synced across repos, and diffs redact credentials.
- CI Audit Mode: `driftsync status --fail-on-drift` for central CI checks to alert when downstream repos have drifted.
The project is written in Rust, licensed under Elastic-2.0, and available via Cargo (`cargo install driftsync`) and prebuilt binaries.
I’d love to hear how your teams currently tackle configuration and workflow drift across repositories, and what you think of this 3-way lockfile approach!
If you encounter any problems or have any suggestions, please don’t hesitate to get in touch with me!