Two writers, one append-only ledger: the git conflict one .gitattributes line fixed, and the files it would have corrupted
Two things write to the same file in our repo: a Claude Code session that records every quote post, repost and reply it sends, and a scheduled GitHub Actions job that posts from a queue five times a day and records what it posted. Both append one JSON line to content/posts/2026-08-28.jsonl . Both commit. Both push to main . Yesterday that arrangement failed for the first time in a way git could…
Two writers were causing conflicts in a shared file within a repository: a Claude Code session and a scheduled GitHub Actions job. Both processes were appending JSON lines to the same file, resulting in merge conflicts when both attempted to commit the changes. The resolution to this issue came in the form of a one-line fix involving the use of the git merge driver "union" in a .gitattributes file.
The union merge driver allows Git to keep both lines when multiple writers append to the same file, as there is no inherent meaning to the order of lines in an append-only file. This solution was documented in the repository's ledger, emphasizing the importance of using the union merge for append-only files where the order of lines is irrelevant.
The fix was implemented as a mechanical script, as manually resolving the conflict would be prone to errors. The incident highlights the need for proper coordination between different processes sharing a file and the potential pitfalls of using certain merge strategies, such as union, in scenarios where duplicate records could be generated.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.