I’ve been using Git for 9 years now, and today was the first time I knowingly encountered a file named .gitkeep
in a diff. “What’s the point of this empty file?”, I thought. Quickly realizing that the idea is to track an empty directory, I started to wonder “Why would you want to make sure a directory exists when there’s nothing to put there?” and I started seeing blog posts about preparing for future changes that will add files to the directory or making sure your team has a consistent directory structure.
Why would you use .gitkeep?
Think big, build small
I’ve been at a few software organizations navigating the transition from small company to established businesses with big customers. At that point, duplication starts to become a cost, and consistency and stability in the product becomes more important than earlier in the business cycle. This is when everything starts getting “platformized” and standardized: application platforms, app development frameworks, managed job queues, data pipelines. These all have the chance to be transformative for your company from a dev experience and cost control perspective. They also routinely get mired in endless migration timelines, and never being “ready enough” for big systems to transition to the platforms.