有些东西不断地重写我的 Gemfile.lock

Dav*_*les 4 ruby bundler

在共享项目上工作时,我经常发现我Gemfile.lock与存储库不同步,产生如下错误消息:

$ git pull
Updating 1911275..8c5d26f
error: Your local changes to the following files would be overwritten by merge:
    Gemfile.lock
Please commit your changes or stash them before you merge.
Aborting
Run Code Online (Sandbox Code Playgroud)

当我尝试git stash更改时,它不起作用:

$ git stash
Saved working directory and index state WIP on development: 1911275 Merge branch 'development' of https://github.com/mygroup/myrepo into development
HEAD is now at 1911275 Merge branch 'development' of https://github.com/mygroup/myrepo into development
$ git status
On branch development
Your branch is behind 'origin/development' by 3 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)
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

no changes added to commit (use "git add" and/or "git commit -a")
Run Code Online (Sandbox Code Playgroud)

如果我stashstatus足够快的速度,我可以看到的变化是越来越藏起来:

$ git stash && git status
Saved working directory and index state WIP on development: 1911275 Merge branch 'development' of https://github.com/mygroup/myrepo into development
HEAD is now at 1911275 Merge branch 'development' of https://github.com/mygroup/myrepo into development
On branch development
Your branch is behind 'origin/development' by 3 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)
nothing to commit, working tree clean
Run Code Online (Sandbox Code Playgroud)

但另一个status节目Gemfile.lock又回来了:

$ git status
On branch development
Your branch is behind 'origin/development' by 3 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)
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

no changes added to commit (use "git add" and/or "git commit -a")
Run Code Online (Sandbox Code Playgroud)

不幸的是,同样的技巧不适用于git stash && git pull; pull太慢了,在pull成功之前锁文件又出现了。

我认为这可能是我的 IDE 在后台重新捆绑,但无论 IDE 是否正在运行,它都会发生。我找不到任何正在运行的 bundler 进程、gem 进程或任何明显的 Ruby 进程。

谁或什么正在重新生成我的文件?

Dav*_*les 7

找到了罪魁祸首,感谢这个答案这个答案同意):Springspring我的机器上有六个流氓进程,其中任何一个或所有进程都必须重新生成文件。杀死这些进程解决了这个问题,到目前为止export DISABLE_SPRING=1,我.bash_profile似乎已经阻止了它再次发生。

spring stop可能也有效。不过,我不知道它是停止所有 Spring 进程还是仅停止其中一个进程。)

  • `killall -9 ruby​​` ftw,厌倦了春天及其干预。 (3认同)
  • 谢谢!`spring stop` 对我有用。 (2认同)