Why would config/database.yml be included in the .gitignore file by default? This small item cost me an hour or two.
The way I stumbled into this trouble:
- I thought I was confused about how git handled reset and revert.
- I had been experimenting with code changes that affected config/database.yml
- I didn’t like the result, so I abandoned the changes.
- It was odd, because it seemed I could not checkout an unedited version of config/database.yml
- I then spent way too much time trying to figure out if I was misunderstanding git’s reset and merge commands.
- Turns out config/database.yml was included in the .gitignore file by default.
Not sure why. Cost me an hour or so of fiddling with reset and merge options, when it turns out I wasn’t even tracking the file. As I write this, I realize I am not entirely sure when .gitignore was written/modified to include config/database.yml
Is there some reason it should be there?
That file usually won’t contain much interesting content for tracking in a version control system.
But, it will often contain passwords for connecting to a database server, which should not be made public.
It will also often contain information which needs to differ between different working copies, different user or database names for a database server, different paths to a SQLite file. These differences would make it impossible to track this file in the version control system.