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?

  • Private Git on OpenShift
  • Create patch or diff file from git repository and apply it to another different git repository
  • git clone with https error - fatal: repository not found
  • Git commands require sudo on OSX
  • Git branch diverged after rebase
  • SSIS solution on GIT?
  • How to merge code in Eclipse
  • How to force `git merge`?
  • Jenkins - Setting up local Git repository for simple HelloWorld test
  • Viewing expired reflog logs
  • Which version of the git file will be finally used: LOCAL, BASE or REMOTE?
  • Show time of merge for a file in git
  • 5 Solutions collect form web for “What is a good .gitignore to use with Rails on Heroku?”

    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.

    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
    

    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).

    On Heroku, the best starting option is:

    db/
    log/
    test/
    tmp/
    

    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.

    Git Baby is a git and github fan, let's start git clone.