用git和Gemfile.lock来解决问题 [英] Troubles with git and Gemfile.lock

查看:290
本文介绍了用git和Gemfile.lock来解决问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论何时我想要执行 git pull ,我都会继续遇到以下错误: Gemfile.lock

 错误:您对以下文件的本地更改将被merge:
Gemfile覆盖。锁定
请在您合并之前提交您的更改或隐藏它们。
正在取消

问题是我无法弄清楚如何解决它。 / p>


  • 存储文件不起作用 - 由于某种原因,本地更改会停留在那里。

  • 我也尝试运行 git checkout - Gemfile.lock 来放弃更改,但这也不起作用 - - 当地的变化只是呆在那里。

  • 我也尝试创建一个新的分支,并将 Gemfile.lock 更改提交给该分支......但是,也不行。更改仍然存在!



我需要做什么?我已经尽力克隆一个新的git仓库,但很快,所有这些都开始发生。

解决方案

这发生在我身上,从接受的答案中找到 git reset --hard HEAD 并没有帮助。但是,运行 spring stop 就行了。我怀疑spring会在修改文件时重写它,以确保它与通过spring运行的代码保持同步。


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.

解决方案

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.

这篇关于用git和Gemfile.lock来解决问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆