Skip to content
This repository
Browse code

Added default .gitignore (this is just recognizing Git market share, …

…don't throw a hissy if you use another SCM) [DHH]
  • Loading branch information...
commit a642edbef31fe96fad488accf0052653c573e8db 1 parent f095e6f
David Heinemeier Hansson authored December 27, 2009
2  railties/CHANGELOG
... ...
@@ -1,5 +1,7 @@
1 1
2 2
+* Added default .gitignore (this is just recognizing Git market share, don't throw a hissy if you use another SCM) [DHH]
3 5
 * Added cookies.permanent, cookies.signed, and cookies.permanent.signed accessor for common cookie actions [DHH]. Examples:
4 6
5 7
     cookies.permanent[:prefers_open_id] = true
1  railties/lib/rails/generators/rails/app/app_generator.rb
@@ -49,6 +49,7 @@ def create_root
49 49
50 50
     def create_root_files
51 51
       copy_file "README"
+      copy_file "gitignore", ".gitignore"
52 53
       template "Rakefile"
53 54
       template ""
54 55
       template "Gemfile"
3  railties/lib/rails/generators/rails/app/templates/gitignore
... ...
@@ -0,0 +1,3 @@

12 notes on commit a642edb

Sam Figueroa

I'm using a gem for that, called git-rails. But I guess this gives people who don't know the gem a break.

Matthew Savage

This comment is gold!

Omar Mekky


Josh Susser

The default gitignore is good. Shouldn't it include database.yml too? Or would that depend on the generator creating database.yml.example instead?

Jordi Bunster

What about schema.rb? /me ducks

Anatoly Mikhailov

Don't you think about seed .gitignore with pretty default settings?

Diego Carrion

I dont think config/database.yml should be in the .gitignore. Depending of the project, it's ok to version and to share database configurations, as when using sqlite3 for development, for example.

László Bácsi

Things like .DS_Store, *.swp, and whatnot should go to your personal .gitignore file at ~/.gitignore

Seth Thomas Rasmussen

Might be nice to take this a step further:

  • only invoke this behavior when requested e.g. you're a Git user
  • add .gitignore files to directories like 'log' which start out empty
Ruby on Rails

greatseth, market share would dictate that, if anything, the option should be to opt-out, not opt-in. Yeah, probably good idea with something in the empty directories.

Josh Susser

If you're going to put keeper files in empty directories, which is probably a good idea, please name them .gitkeep instead of .gitignore. Overriding the name .gitignore is just confusing, and it's also exactly the opposite of what you want to accomplish.

Jordi Bunster

I think Rails creates those directories anyway. FileUtils#mkdir_p and what not.

Please sign in to comment.
Something went wrong with that request. Please try again.