Horse Voice
Horse Voice

Reputation: 8348

accidentally removed log folder in rails .gitignore, log folder not being generated on pull request

I'm new to git and rails. I checked out a rails project and had a bunch of log files come in with it. I wanted to remove the log files and add an entry into .gitignore to ignore contents of the log directory. I think I screwed up because when my colleague tried to checkout from master, his log directory didn't even get generated. I think instead of ignoring contents of the log file, I ignored the entire log directory. What's the best way to change this .gitignore file to only ignore log files NOT the log directory itself? Also I don't think I need all these things in the .gitignore. What's a nice clean and simple .gitignore for a rails project?

*.sublime-*
.bundle
db/*.sqlite3*
log/*.log
*.log
tmp/**/*
tmp/*
Gemfile.lock
doc/api
doc/app
*.swp
*~
.DS_Store

Thank you in advance.

Upvotes: 0

Views: 536

Answers (1)

BroiSatse
BroiSatse

Reputation: 44715

Git ignores empty folders, in fact it doesn't really know they exist (it knows about trees pointing toward file contents). Since there is no file content to point to, there is no tree and hence git will not create a folder.

Common way around this is to add empty file within the folder. Convention is to name this file .keep. Add such file to the empty folder, add it to the index, commit and push and folder will be created on checkout.

Upvotes: 1

Related Questions