Github プルリクエストの際に気をつけること

 File Changed 806 のままプルリクエストを作成してしまいました。

File changedの数まで見ていなかったことが原因。以前レビューを受けたときは

35だったので比較すると明らかにおかしい。

ファイルを見ていくとvendor/bundle以下のファイルが多く作られていることを

確認。これを.gitignoreに記述していけばよいみたいです。

ついでに他にも必要のないファイルがgitに反映されないようにしていきます。

 

 

.gitignore
.DS_Store
database_yml
vendor/bundle
/.bundle
.vscode/

 

 

*.rbc
  capybara-*.html
  .rspec
  /db/*.sqlite3
  /db/*.sqlite3-journal
  /db/*.sqlite3-[0-9]*
  /public/system
  /coverage/
  /spec/tmp
  *.orig
  rerun.txt
  pickle-email-*.html
   
  # Ignore all logfiles and tempfiles.
  /log/*
  /tmp/*
  !/log/.keep
  !/tmp/.keep
   
  # TODO Comment out this rule if you are OK with secrets being uploaded to the repo
  config/initializers/secret_token.rb
  config/master.key
   
  # 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
   
  # Ignore node_modules
  node_modules/
   
  # Ignore precompiled javascript packs
  /public/packs
  /public/packs-test
  /public/assets
   
  # Ignore yarn files
  /yarn-error.log
  yarn-debug.log*
  .yarn-integrity
   
  # Ignore uploaded files in development
  /storage/*
  !/storage/.keep
 
 
gitの追跡対象からvendor/bundleを除外する

 

以下のコマンドでgitの追跡対象からvendor/bundleを除外します。bundleはディレクトリなので、-r オプションもつけます。

--chachedオプションをつけているので、実際のディレクトリは削除されません。

git rm  --cached -r vendor/bundle

 

 gitの追跡対象から除外した状態でcommit

git commit -m "git rm --chached -r vendor/bundle"

 

 

参考

https://qiita.com/mimushu/items/2e54845c6b28b60ef17f

https://qiita.com/fuji_20/items/a4f875956f0b087668f6

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