Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Two writers, one append-only ledger: the git conflict one .gitattributes line fixed, and the files it would have corrupted

Description and use

Two processes append to the same JSONL file, causing merge conflicts. Adding merge=union in .gitattributes automatically merges appended lines, eliminating conflicts for append‑only files.

Problem

Two automated processes append to the same JSONL file and commit, causing merge conflicts that Git cannot resolve automatically.

Outcome

A single .gitattributes line (merge=union) resolved merge conflicts for append‑only JSONL files, reducing manual intervention and preventing duplicate records in ledger files that are only appended to.

Workflow

  • 1. Two writers (Claude session and scheduled job) append a JSON line to content/posts/2026-08-28.jsonl.
  • 2. Each writer commits and pushes to main via a rebase‑push script.
  • 3. When both writers push, Git detects a merge conflict on the file.
  • 4. The rebase stops; a manual merge script is run to combine the lines.
  • 5. The script is added to the mechanization‑debt ledger.
  • 6. A .gitattributes entry is added: content/posts/*.jsonl merge=union.
  • 7. Subsequent pushes automatically merge appended lines without conflict.
  • 8. For files that can be rewritten, no union merge is applied, so conflicts remain visible.

Evidence

Git ships a merge driver for exactly this shape. From the gitattributes documentation: union — Run 3‑way file level merge for text files, but take lines from both versions, instead of leaving conflict markers.

Source

The documentation's warning is not boilerplate. Union merge does not know what a record is; it knows what a line is.

Source

  • Record date: 2026-09-05T19:00:15.107Z