Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"modified: Gemfile.lock", Why?

When I 'git status' on my sub branch, I frequently see "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.

like image 294
Mellon Avatar asked Mar 25 '11 11:03

Mellon


2 Answers

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.

like image 140
nonopolarity Avatar answered Oct 26 '22 12:10

nonopolarity


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 
like image 22
Kliment Mamykin Avatar answered Oct 26 '22 12:10

Kliment Mamykin