[Ruby] Bundle install causes a large amount of git differences for gem files

1 minute read

generated background

When inserting a new gem, the following command may cause a large amount of diff in git.


bundle install --path vender/bundle

(The place called “Unstaged Files (1)” in the screenshot is 10000. Sorry, I could not reproduce it.) image.png

I would like to consider how to deal with this matter.


| Item | Content | |:—————–|:——————:| | OS.Catalina | v10.15.4 | | Ruby | v2.5.1 | | Ruby On Rails | v5.2.4.3 | | Git | 2.20.1 |


[1] Edit Gitignore. There is a Gitignore format. See Reference “Easy way to get an edited .gitignore” for details. The following contents are posted.



# TODO Comment out this rule if you are OK with secrets being uploaded to the repo

# 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

## Environment normalization:

# 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:

# if using bower-rails ignore default bower_components path bower.json files

# Ignore pow environment settings

# Ignore Byebug command history file.

Especially “/vendor/bundle” is important. If I give it to git, the performance will drop and all the bad things will happen, so I not only rewritten the above, but also added it to the existing file.


Easy way to get the edited .gitignore