LoginSignup
2
0

Railsの.gitignoreファイルのテンプレ

Last updated at Posted at 2023-05-29

概要

いくつかの記事を参考にRuby on RailsのプロジェクトでデータベースにSQLiteを使用し、一般的に使用されるものをカバーしているであろうgitignoreファイルのテンプレを掲載致します。

.gitignoreファイルのテンプレ

.gitignore
# Ignore bundler config.
/.bundle

# Ignore the specific database config file.
/config/database.yml

# Ignore all logfiles and tempfiles.
/log/*.log
/tmp

# Ignore other unneeded files.
doc/
*.swp
*~
.project
.DS_Store
.idea
.secret

# Ignore bundler gems.
/vendor/bundle

# Ignore application's specific configuration file
/config/credentials.yml.enc
/config/master.key

# Ignore files related to IDE
/.vscode
/.idea/
/.rubymine*
/.ruby-version
/.ruby-gemset

# Ignore node modules
/node_modules

# Ignore precompiled assets for production environment
/public/assets

# Ignore SQLite database files
/db/*.sqlite3
/db/*.sqlite3-journal

以上のファイルに、以下の様な条件で変更を加えると、適した.gitignoreファイルを作成出来ると思います。

  • 他のデータベースを使用している場合(PostgreSQLやMySQLなど)、それらの特定のファイルを無視する必要があるかどうか確認。
  • 開発環境に依存するファイルやディレクトリ(たとえば、エディターまたはIDEの設定ファイル)が他にあるかどうか確認。
  • 特定のOSに関連する無視すべきファイルが他にあるかどうか確認(.DS_Storeのような)。
  • 使用している特定のgemやプラグインが生成する一時ファイルやログファイルがあるかどうか確認。

PostgreSQL又はMySQLを使用する場合

.gitignore
# Ignore bundler config.
/.bundle

# Ignore the specific database config file.
/config/database.yml

# Ignore all logfiles and tempfiles.
/log/*.log
/tmp

# Ignore other unneeded files.
doc/
*.swp
*~
.project
.DS_Store
.idea
.secret

# Ignore bundler gems.
/vendor/bundle

# Ignore application's specific configuration file
/config/credentials.yml.enc
/config/master.key

# Ignore files related to IDE
/.vscode
/.idea/
/.rubymine*
/.ruby-version
/.ruby-gemset

# Ignore node modules
/node_modules

# Ignore precompiled assets for production environment
/public/assets

参考

Ruby on Railsの.gitignoreファイルはコレで決まり

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0