"Bundle install" causes a lot of git differences for gem files

Occurrence background </ font>

When inserting a new gem, running the following command may cause a lot of diffs in git.

command


bundle install --path vender/bundle

(The "Unstaged Files (1)" in the screenshot may be 10,000 or something. I'm sorry, I couldn't reproduce it.) image.png

I would like to consider how to deal with this matter. </ font>

environment </ font>

item Contents
OS.Catalina v10.15.4
Ruby v2.5.1
Ruby On Rails v5.2.4.3
Git 2.20.1

Correspondence procedure </ font>

[1] Edit Gitignore. There is a Gitignore format. See the reference "Easy way to get an edited .gitignore" for more information. The following contents are posted.

.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

Especially "/ vendor / bundle" is important. If you give it to git, the performance will drop, and there are many bad things, so I not only rewrote the above, but also added it to the existing file.

References </ font>

Easy way to get edited .gitignore