Since February when I shared my .gitignore file, I've refined it a bit. Here's the new version:
# Ignore configuration files that may contain sensitive information. sites/*/settings*.php # Ignore various other cruft .DS_Store .buildpath .project .settings /backup /tmp # Ignore paths that contain user-generated content. sites/*/files sites/*/private
The first section does something very important--it blocks uploading the database name, username and password to your git repository. I never worried very much as I have a private repo hosted on my own server. However, if you push your code to a public place like Github, you're just inviting trouble.
The second section is pretty much what I had in my original article.
If you have any tricks for you .gitignore file, please share in the comments!