hn.today

Maybe a better way to track the release history of a Git repo

blog.plover.com33 points8 comments
Screenshot of Maybe a better way to track the release history of a Git repo

A monorepo accumulated thousands of deployment tags like refs/release/stg.www.our-app-YYYY... that encoded tier, app, timestamp, and tree hash in their names. Those many refs slowed operations because Git had to search packed-refs for every ref resolution, cluttered common commands, and simply encoded metadata as a naming convention rather than as first-class, immutable data. Tags are mutable and deleting or inserting tags breaks the audit trail. Common questions - when was the last prod deploy of an app, or what was the version immediately before the most recent - required filtering and sorting the entire tag list, which became impractical at scale.

The proposed alternative represents each (tier, app) as one ref pointing to a chain of metainfo commits. Each metainfo commit has two parents: the previous metainfo commit (first parent) and the actual release commit (second parent). Metainfo commits store release metadata either in the commit message/trailers or in a dedicated tree; their creation time is the release time. New releases are created with git commit-tree -p <old-meta> -p <release-commit> ... and the new meta SHA is pushed to the single ref. Fetching and querying (git fetch ref:HISTORY; git log HISTORY; HISTORY^2 is current release; HISTORY~N^2 is N releases back) then leverages Git’s native history traversal for efficient searches, diffs, and rollbacks while keeping only one ref per deployment target. The idea was proposed in 2019 but was not widely adopted and could have unforeseen drawbacks.

Read on blog.plover.com8 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

Recreational Programming

Recreational Programming

Recreational programming is driven by curiosity and intrinsic motivation, focusing on enjoyment rather than external goals like career advancement or profit. It encompasses diverse styles such as exploring new languages, artistic coding, and building for fun, emphasizing learning, creativity, and personal growth. (cphiri.dev)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.