2/21/2026 at 2:12:44 AM
I'm not sure if I'm the one to blame for this or not, but the earliest reference to ".gitkeep" I can find online is my 2010 answer on Stack Overflow: https://stackoverflow.com/a/4250082/28422If this is all my fault, I'm sorry.
by jkubicek
2/21/2026 at 8:36:52 AM
This Rails commit from May 2010 mentions gitkeeps and it's a few months older than your SO post, so it seems you're absolved from guilt:https://github.com/rails/rails/commit/785493ffed41abcca0686b...
by pilaf
2/22/2026 at 5:15:56 AM
Dummy empty files such as .keepme were used in CVS repositories for exactly the same purpose, and probably other version controls systems long before Git existed.The Peter Cederqvist manual recommended the practice.
Here is a 1993 dated copy someone left hosted:
https://www.astro.princeton.edu/~rhl/cvs/cvs.html
The paragraph which recommends the .keepme files is:
https://www.astro.princeton.edu/~rhl/cvs/cvs.html#SEC63
"if you want an empty directory then put a dummy file (for example `.keepme') in it to prevent `-P' from removing it."
by kazinator
2/21/2026 at 2:51:24 PM
Yeah... I don't think you were wrong. Having 100 tiny gitignores makes finding out why something is excluded annoying. Our policy is one root level gitgnore and gitkeeps where required.Some devs will just open the first gitignore they see and throw stuff into it. No thank you.
by hn92726819
2/21/2026 at 8:13:29 PM
I like to make a .local folder at the top of the project, which contains a .gitignore that ignores everything. Then I can effortlessly stash my development notes there without affecting the project .gitignore or messing around within the .git directory.by zahlman
2/22/2026 at 6:50:01 PM
You can create a global gitignore in your home directory. I have ‘.<myname>’ ignored there, so if I ever create a directory with that name I know it’s contents won’t go into source control. That way I don’t have to edit the repositories gitignore with me-specific stuff.by ddek
2/22/2026 at 10:31:49 PM
You wouldn't have to edit the actual repositories gitignore anyways. Every checkout of a repo comes with a .git/info/exclude file, which acts like a local additional gitignore file.by hobofan
2/22/2026 at 10:50:05 AM
Why not put '.local' in your toplevel gitignore, and not commit an empty .local folder up to the forge?by beAbU
2/22/2026 at 6:35:35 PM
Upstream never sees an empty .local folder because, as established, Git doesn't keep empty folders. This way, .local isn't mentioned in the top-level .gitignore. It's just that tiny bit cleaner.by zahlman
2/21/2026 at 8:05:26 PM
I share your view. .keep and .gitignore are different things. Having one .gitignore caputuring everything is less mental load.by predkambrij
2/21/2026 at 9:20:59 PM
I agree with you. Empty .gitignore would be a "smell" to me. Whereas .gitkeep tells me exactly what purpose it serves. I like the semantic difference here that you describe. I don't like when multiple .gitignore files are littered throughout the codebase.by taftster
2/21/2026 at 8:26:30 PM
> Having 100 tiny gitignores makes finding out why something is excluded annoying. Our policy is one root level gitgnore and gitkeeps where required.This is not a complicated or important enough problem to justify a team-wide policy. Let it work itself out naturally.
https://git-scm.com/docs/git-check-ignore makes it trivial to debug repo-wide gitignore behavior.
by nickysielicki
2/22/2026 at 9:59:19 AM
We could say that practically all problems would work them self out one way or another.I heard facebook allows any language as long as you have packaged it neatly with all required build chain. (I.e. Even a choice of language works out)
Some lowest common denominator will be reached. (1 :) )
On the other hand: Are we happy with the lowest or do we want to aim higher?
by lucketone
2/21/2026 at 2:28:26 AM
This is delightful. Accidental load-bearing SO post.by selridge
2/21/2026 at 2:32:39 AM
It's especially funny since my answer is wrong anyway! The other top answer is much better. I did get a lot of early SO brownie points from that one answer though.by jkubicek
2/21/2026 at 3:45:51 AM
[dead]by juggerl6
2/21/2026 at 4:56:48 AM
Well, Claude is here making .gitkeep files like nobody's business.by adastra22