Live data from Hacker News

Don't create .gitkeep files, use .gitignore instead (2023)

adamj.eu

21–30 of 101 posts

Re: Don't create .gitkeep files, use .gitignore instead (2023)

#21

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/28422 If this is all my fault, I'm sorry.

This is delightful. Accidental load-bearing SO post.

Re: Don't create .gitkeep files, use .gitignore instead (2023)

#22

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/28422 If this is all my fault, I'm sorry.

This is delightful. Accidental load-bearing SO post.

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.

Re: Don't create .gitkeep files, use .gitignore instead (2023)

#25
post #11

Earlier quoted context omitted.

The idea is that instead of adding a nonsense file, you use the native .gitignore functionality. ".gitkeep" is just a human thing; it would work the same if you called it ".blahblah". So their pitch is that if you want to explicitly keep the existence of the directory as a committed part of the repo, you're better off using the actual .gitignore functionality to check in the .gitignore file but ignore anything else i…

This still confuses me. Do you mean to say "use the .gitignore functionality, and check in the .gitkeep file"?

[deleted]

Re: Don't create .gitkeep files, use .gitignore instead (2023)

#29
post #11

Earlier quoted context omitted.

The idea is that instead of adding a nonsense file, you use the native .gitignore functionality. ".gitkeep" is just a human thing; it would work the same if you called it ".blahblah". So their pitch is that if you want to explicitly keep the existence of the directory as a committed part of the repo, you're better off using the actual .gitignore functionality to check in the .gitignore file but ignore anything else i…

This still confuses me. Do you mean to say "use the .gitignore functionality, and check in the .gitkeep file"?

No. Use a .gitignore instead of .gitkeep. Instead of checking in build/.gitkeep, check in build/.gitignore.
Post reply on HN