Gemfile.lock总是具有未提交的更改 [英] Gemfile.lock always has changes not staged for commit

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

问题描述

我正在使用我正在开发的Rails应用程序中遇到这个问题。我正在研究一个功能分支,并希望从最新的主人发放。我运行了下面的命令:

$ $ $ $ $ g $ check $ $ $ $ $ git pull --rebase
code>

如果我尝试结帐回我的功能分支,我收到以下错误:

 没有为commit提交更改:
(使用git add< file> ...更新将提交的内容)
(使用 git checkout - < file> ...放弃工作目录中的更改)

修改:Gemfile.lock

我尝试了以下命令将Gemfile.lock解析回aster,但没有成功:

  $ git checkout  -  Gemfile.lock 
$ git stash
$ git reset HEAD --hard

每次运行一个新的git命令时,我都会返回Gemfile.lock,其中的变化未进行提交。



以下是我正在使用的库的下列版本:

  $ git --version => 2.3.3 
$ bundler --version => 1.7.9


解决方案

背景或在你的shell中执行git命令的一些副作用是修改Gemfile.lock。



我对rvm的魔法不熟悉(尽管听起来很合理) ;这里有一些其他的事情要检查:


  • 在最近的Rails版本中,有一个spring后台进程在运行。尝试运行 spring stop (或 bin / spring stop bundle exec spring stop
  • 同样,如果您有任何其他与Rails相关的进程(如Rails服务器,守卫,zeus,sidekiq等)正在运行,请尝试关闭这些进程。

  • 你可能正在运行一个git pre-commit hook。检查 .git / hooks 目录。

  • git 可能是别名在你的shell中另一个命令。运行 alias 查看shell别名列表。

  • 您的shell提示符可能正在执行代码来执行诸如显示当前git状态和提示中的分支名称。此代码将在每个shell命令之后执行以重新绘制提示,并可能有副作用。检查 .bashrc .bash_profile


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:

$ git checkout master
$ git pull --rebase

If I try to checkout back to my feature branch I get the following error:

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

  modified:   Gemfile.lock

I have tried the following commands to resolve the Gemfile.lock back to aster with none of them being successful:

$ git checkout -- Gemfile.lock
$ git stash
$ git reset HEAD --hard

Every time I run a new git command I go back to the Gemfile.lock having changes not staged for commit.

Here are the following versions of libraries I am working with:

$ git --version => 2.3.3
$ bundler --version => 1.7.9

解决方案

There must be some process running in the background or some side-effect of executing the git commands in your shell that is modifying the Gemfile.lock.

I am not familiar with rvm's magic (although that sounds plausible); here are some other things to check:

  • In recent versions of Rails there is a "spring" background process that runs. Try running spring stop (or bin/spring stop or bundle exec spring stop) to gracefully terminate that process.
  • Likewise if you have any other Rails-related processes like rails server, guard, zeus, sidekiq, etc. running, try shutting those down.
  • You might be running a git pre-commit hook. Check the .git/hooks directory.
  • git might be an alias in your shell for another command. Run alias to see a list of shell aliases.
  • Your shell prompt might be executing code to do things like show the current git status and branch name in the prompt. This code would be executed after every shell command to redraw the prompt, and might have side-effects. Check your .bashrc or .bash_profile.

这篇关于Gemfile.lock总是具有未提交的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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