Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I keep running into the following error with my Gemfile.lock whenever I want to do a git pull or checkout a new branch.

error: Your local changes to the following files would be overwritten by merge:
    Gemfile.lock
Please, commit your changes or stash them before you can merge.
Aborting

The problem is that I can't figure out how to fix it.

  • Stashing the file doesn't work -- the local changes just stay there for some reason.
  • I've also tried running git checkout -- Gemfile.lock to discard the changes, but that doesn't work either -- the local changes just stay there.
  • I've also tried creating a new branch and committing the Gemfile.lock changes just to that branch... but that doesn't work either. The changes remain!

What do I need to do? I've gone so far as to just clone a new git repo, but soon enough, all this starts happening again.

question from:https://stackoverflow.com/questions/30834674/troubles-with-git-and-gemfile-lock

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
405 views
Welcome To Ask or Share your Answers For Others

1 Answer

This happened to me and git reset --hard HEAD from the accepted answer didn't help. However, running spring stop did the trick. I suspect spring is rewriting the file whenever it is modified to ensure that it is in sync with the code running via spring.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...