5

I am setting up a new source control repository for a Ruby on Rails project. I am using Mercurial and I am wondering which part of my local directory to check in.

The way I have it set up locally in the project workspace is the following file structure:

drwxr-xr-x 7 agenadinik agenadinik 4096 2011-04-27 09:58 app
drwxr-xr-x 5 agenadinik agenadinik 4096 2011-04-27 09:58 config
-rw-r--r-- 1 agenadinik agenadinik  154 2011-04-27 09:58 config.ru
drwxr-xr-x 3 agenadinik agenadinik 4096 2011-04-29 14:12 db
drwxr-xr-x 2 agenadinik agenadinik 4096 2011-04-27 09:58 doc
-rwxrwxrwx 1 agenadinik agenadinik  781 2011-05-05 18:57 Gemfile
-rw-r--r-- 1 agenadinik agenadinik 1745 2011-05-05 18:57 Gemfile.lock
drwxr-xr-x 3 agenadinik agenadinik 4096 2011-04-27 09:58 lib
drwxr-xr-x 2 agenadinik agenadinik 4096 2011-04-27 09:58 log
drwxr-xr-x 3 agenadinik agenadinik 4096 2011-05-02 17:16 mysql2
drwxr-xr-x 5 agenadinik agenadinik 4096 2011-04-29 13:17 public
-rw-r--r-- 1 agenadinik agenadinik  264 2011-04-27 09:58 Rakefile
-rw-r--r-- 1 agenadinik agenadinik 9126 2011-04-27 09:58 README
drwxr-xr-x 2 agenadinik agenadinik 4096 2011-04-27 09:58 script
drwxr-xr-x 7 agenadinik agenadinik 4096 2011-04-27 09:58 test
drwxr-xr-x 6 agenadinik agenadinik 4096 2011-04-27 09:58 tmp
drwxr-xr-x 3 agenadinik agenadinik 4096 2011-04-27 09:58 vendor

Thanks, Alex

GeekedOut
  • 16,905
  • 37
  • 107
  • 185

4 Answers4

5

Gemfile.lock MUST be checked in!

Ignore

  • tmp/
  • db/*.sqlite
  • public/system/*
  • log/*
Aditya Sanghi
  • 13,370
  • 2
  • 44
  • 50
3

I believe you should ignore

  • tmp/.
  • db/*.sqlite
  • public/assets(system etc - attaches)
  • log/*

EDIT

@normalocity wrote:
Any any file that contains sensitive information (especially if the code repository is in a public place, such as Git). For example, I have an app that stores my SMTP server password in a file so my app can send email. The file that contains that password is NOT included in my repository, however. I secure-copy it by hand if there are changes to the file (which are extremely rare, and obvious when my test suite fails, in my case). – normalocity

fl00r
  • 82,987
  • 33
  • 217
  • 237
  • 2
    Gemfile.lock MUST be checked in!! – Aditya Sanghi May 09 '11 at 21:11
  • 1
    Any any file that contains sensitive information (especially if the code repository is in a public place, such as Git). For example, I have an app that stores my SMTP server password in a file so my app can send email. The file that contains that password is NOT included in my repository, however. I secure-copy it by hand if there are changes to the file (which are extremely rare, and obvious when my test suite fails, in my case). – jefflunt May 09 '11 at 21:13
  • @Aditya Sanghi, you're right, related topic: http://stackoverflow.com/questions/4151495/should-gemfile-lock-be-included-in-gitignore – fl00r May 09 '11 at 21:13
  • I was actually confused with `Gemfile.lock`. And never learned why I need this. So it is the case when the answering is the studying at the same time :). Thank you @Aditya Sanghi – fl00r May 09 '11 at 21:22
2

This is a good guide: http://railscasts.com/episodes/36-subversion-on-rails

You basically want to ignore these files:

  • log/*
  • tmp/*
  • config/database.yml
Abdullah Jibaly
  • 53,220
  • 42
  • 124
  • 197
2

Rails 3 projects defaults to ignore these files (for Git, but it should be the same for any VCS):

.bundle
db/*.sqlite3
log/*.log
tmp/

I would recommend that you DO keep your Gemfile.lock in your repository. If anyone else is working on the same project, it will guarantee that everyone is working with the exact same versions of each gem. See more here.

Dylan Markow
  • 123,080
  • 26
  • 284
  • 201