Working on a shared project, I often find that my Gemfile.lock
gets out of sync with the repository, producing error messages like:
$ 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
When I try to git stash
the change, it doesn't work:
$ 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")
If I stash
and status
quickly enough, I can see that the change is getting stashed:
$ 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
But another status
shows that Gemfile.lock
has come back:
$ 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")
Unfortunately the same trick doesn't work with git stash && git pull
; pull
is too slow, and the lockfile reappears before the pull can succeed.
I thought it might be my IDE re-bundling in the background, but it happens whether or not the IDE is running. I can't find any running bundler processes, gem processes, or indeed any obvious Ruby processes of any kind.
Who or what is regenerating my file?