Gemfile.lock always has changes not staged for commit

后端 未结 2 938
后悔当初
后悔当初 2021-02-14 19:17

I am running into this problem on a rails app I am working on. I was working on a feature branch and wanted to rebase from the most recent master. I ran the following commands:<

2条回答
  •  囚心锁ツ
    2021-02-14 19:39

    There are times that running a rails command or other bundle exec command will silently update your Gemfile.lock. I am guessing you are doing that sometime in between your git commands. Or you have something weird installed that does that invisibly.

    (Could rvm do this invisibly? I don't know. I think rvm does all kinds of odd stuff and don't use it.).

    At any rate, the fact that this is happening is probably evidence of something else going on that isn't what you want -- are you sure the Gemfile and Gemfile.lock you are trying to commit together are actually compatible? Normally any time a Gemfile changes at all, it is wise to run bundle install to get a new Gemfile.lock. If you are trying to commit a Gemfile.lock which actually isn't compatible with the Gemfile... I am not sure why you would want to do that anyway, normally I want the Gemfile and Gemfile.lock in any given commit to be compatible.

    To get a clue as to why something (mysterious) may be changing your Gemfile.lock, do a git diff on the Gemfile.lock to see how it's changed?

提交回复
热议问题