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?

  • Force push current branch
  • How to locate the git config file in Mac
  • Toward an ideal workflow with ClearCase and Git
  • XCode source control: view changes for one file
  • Git: show dates in UTC
  • How to make sure teammates don't screw up the git repo by rewriting history?
  • Static web frontend for Git/Mercurial/Darcs
  • Not Possible to switch branch after --skip-worktree
  • Visual Studio 2015 update 2 - Git is showing me in changes all the bin\debug and obj\debug folder/files , why would it be ignoring the gitignore
  • Prevent Git from changing permissions on pull
  • git pull *after* git rebase?
  • Git change working directory
  • 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.