---
title: "How We’re Building Git for Infrastructure"
description: "Railway's Changesets let teams fork an infrastructure environment like a Git branch, record each config or service change as a changeset, and merge it back into the parent environment."
url: "https://swe.quest/articles/how-we-re-building-git-for-infrastructure-bcbbd9a523c86b11"
canonical: "https://blog.railway.com/p/launch-week-01-changesets"
source: "Railway"
published: "2023-09-28"
difficulty: "medium"
kind: "Case study"
reading_minutes: 9
tags: ["configuration","testing","postgres","system-design","deployment"]
---

# How We’re Building Git for Infrastructure

A post on [Railway](https://swe.quest/sources/railway.md), published 2023-09-28, 9 min read, Case study. Original: [https://blog.railway.com/p/launch-week-01-changesets](https://blog.railway.com/p/launch-week-01-changesets)

## Summary

Railway's Changesets let teams fork an infrastructure environment like a Git branch, record each config or service change as a changeset, and merge it back into the parent environment. Instead of storing Git-style parent pointers (too many sequential queries) or rebuilding the tree in memory (too memory-heavy), each changeset has a single original environment and an ordering id from a PostgreSQL serial column, and each environment records its parent and fork point, so a diff is one simple query. The scope was deliberately limited to fork-and-merge-into-parent, with no arbitrary environment merges or merge requests. Tests use a Mermaid gitGraph-like DSL helper that can also print a Mermaid diagram of the test state for visual debugging.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Configuration management](https://swe.quest/tags/configuration.md) (Reliability & operations)
- [Testing](https://swe.quest/tags/testing.md) (Engineering practices)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [System design](https://swe.quest/tags/system-design.md) (Architecture & design)
- [Deployment](https://swe.quest/tags/deployment.md) (Reliability & operations)

## Prerequisites

- Git branching and merging
- relational database basics ([easy posts on Databases](https://swe.quest/tags/databases.md?difficulty=easy))

## Keywords

Railway, Changesets, Mermaid, PostgreSQL, Git

## Related posts

- [Postgres for Ephemeral Environments: A Method to Keep Data Persistent](https://swe.quest/articles/postgres-for-ephemeral-environments-a-method-to-keep-data-persistent-5ef8547c6782b2cb.md): Neon · 2025-01-07 · Easy · 7 min read · PostgreSQL, Deployment, CI/CD, Testing
  Neon branches, which are copy-on-write clones of a Postgres database, can provide pre-seeded databases for ephemeral PR environments.
- [Building Git infrastructure for agent-scale development](https://swe.quest/articles/building-git-infrastructure-for-agent-scale-development-3f8b84d59639a2ff.md): GitHub Engineering · 2026-10-06 · Easy · 8 min read · Version control, Distributed systems, Scaling, Replication, Storage systems
  GitHub is rebuilding its Git storage layer because agent-driven workloads are colliding with the design of Spokes.
- [How To Maintain Seed Files (And Why You May Not Want To Do It)](https://swe.quest/articles/how-to-maintain-seed-files-and-why-you-may-not-want-to-do-it-8f196f8d27fea45b.md): Neon · 2025-02-05 · Medium · 7 min read · Databases, Testing, PostgreSQL, Ruby, Developer productivity
  Seed files should be versioned alongside schema changes, executed automatically in pipelines, split by environment, made incremental like migrations, and written to be idempotent, with Ruby/Rails and Docker Compose examples showing each practice.
- [Supabase Branching](https://swe.quest/articles/supabase-branching-4fbb0c9896d51627.md): Supabase · 2023-12-13 · Medium · 5 min read · Schema migrations, PostgreSQL, CI/CD, Deployment
  Supabase Branching gives each Git branch an isolated hosted Preview environment with its own Postgres database, Auth, Storage, Realtime, Edge Functions and APIs, plus separate credentials.
- [Inside GitHub’s new Git storage architecture](https://swe.quest/articles/inside-github-s-new-git-storage-architecture-014a8644555e81c8.md): GitHub Engineering · 2026-11-05 · Hard · 15 min read · Version control, Storage systems, Distributed systems, Scaling, Replication
  GitHub's new Git storage architecture, Rubicon, rests on one observation: only reference updates need ordering.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
