Victor
Victor

Reputation: 23932

What is a good .gitignore to use with Rails on Heroku?

What is a good .gitignore to use with Rails on Heroku?

*.log  
*.sqlite3

what else?

Upvotes: 28

Views: 19452

Answers (5)

Shaliko Usubov
Shaliko Usubov

Reputation: 477

https://github.com/github/gitignore/blob/master/Rails.gitignore

*.rbc
capybara-*.html
.rspec
/log
/tmp
/db/*.sqlite3
/db/*.sqlite3-journal
/public/system
/coverage/
/spec/tmp
**.orig
rerun.txt
pickle-email-*.html

# TODO Comment out this rule if you are OK with secrets being uploaded to the repo
config/initializers/secret_token.rb

# Only include if you have production secrets in this file, which is no longer a Rails default
# config/secrets.yml

# dotenv
# TODO Comment out this rule if environment variables can be committed
.env

## Environment normalization:
/.bundle
/vendor/bundle

# these should all be checked in to normalize the environment:
# Gemfile.lock, .ruby-version, .ruby-gemset

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

# if using bower-rails ignore default bower_components path bower.json files
/vendor/assets/bower_components
*.bowerrc
bower.json

# Ignore pow environment settings
.powenv

# Ignore Byebug command history file.
.byebug_history

Upvotes: 11

dAIvd
dAIvd

Reputation: 1480

On Heroku, the best starting option is:

db/
log/
test/
tmp/

Upvotes: 1

SnapShot
SnapShot

Reputation: 5544

There is a project on Github dedicated to storing accurate gitignore files for different languages, editors, etc. While the project does not currently have an entry specific to Heroku, you might still find it useful to review. The project is here and the Rails .gitignore is here.

FYI, I first found out about this project from this Stack Overflow question.

Upvotes: 1

Dan McNevin
Dan McNevin

Reputation: 22336

This is pretty similar to: Rails: exclude anything from version control? Here is my answer from that.

DHH just posted on Twitter that there will be a default .gitignore in Rails 3, which includes:

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

This is usually what I exclude. Some people also like to exclude the database.yml file if it's going on a public repo and you don't want to expose your database passwords.

Upvotes: 36

Franck Verrot
Franck Verrot

Reputation: 1041

Keep in mind that Heroku's slug compiler has a very similar feature using a file named .slugignore. This file syntax is roughly the same as in .gitignore.

So you can continue working as usual (ie: storing PSD files, spreadsheets and other common files) but remove them at runtime on Heroku to lower the slug's size (< 20MB sounds good).

Upvotes: 5

Related Questions