开发者

"modified: Gemfile.lock", Why?

开发者 https://www.devze.com 2023-02-19 22:37 出处:网络
When I \'git status\' on my sub branch, I frequently s开发者_运维问答ee \"modified:Gemfile.lock\", BUT I have never touch this file, why git always tell me it is modified??

When I 'git status' on my sub branch, I frequently s开发者_运维问答ee "modified: Gemfile.lock", BUT I have never touch this file, why git always tell me it is modified??

I am developing Rails 3 application under Ubuntu machine.


I think it is because you ran

bundle install

it will change the Gemfile.lock to tell exactly what versions of each gem your project is using so that when something breaks, you can trace back what versions of gem you were using earlier.


I see the same thing when developing on Mac OS and Ubuntu. When I pull the code to Ubuntu machine that has Gemfile.lock created on Mac machine, and after running rails server I get Gemfile.lock modified:

diff --git a/Gemfile.lock b/Gemfile.lock
index 7fcc61b..5f06101 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -113,7 +113,7 @@ GEM
     faraday (0.5.3)
       addressable (~> 2.2.2)
       multipart-post (~> 1.0.1)
-      rack (>= 1.1.0, < 2)
+      rack (< 2, >= 1.1.0)
     formtastic (1.2.3)
       actionpack (>= 2.3.7)
       activesupport (>= 2.3.7)
@@ -126,9 +126,9 @@ GEM
       haml (~> 3.0)
       railties (~> 3.0)
     heroku (1.13.7)
-      json_pure (>= 1.2.0, < 1.5.0)
+      json_pure (< 1.5.0, >= 1.2.0)
       launchy (~> 0.3.2)
-      rest-client (>= 1.4.0, < 1.7.0)
+      rest-client (< 1.7.0, >= 1.4.0)
     heroku_san (1.0.7)
       heroku
     hpricot (0.8.3)

Looks like not essential changes, just reordered version constraints. But quite annoying. I usually

git checkout -- Gemfile.lock 
0

精彩评论

暂无评论...
验证码 换一张
取 消