53

bundle update and bundle install is ver fantastic. However, is there a good way to undo bundle install and bundle update if something went wrong ?

Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
hey mike
  • 2,431
  • 6
  • 24
  • 29

3 Answers3

115

There is one obvious way:

git checkout -- Gemfile.lock

and then run

bundle install

It assumes you use git - but who does not now days, I have everything in git.

Mic Fok
  • 837
  • 11
  • 12
mpapis
  • 52,729
  • 14
  • 121
  • 158
  • 8
    git checkout by default tries to checkout git branch, if you specify `--` it knows it has to checkout files ... it's only in case you would have a branch named the same as one of your files - but it's a good habit. – mpapis Mar 12 '12 at 15:30
6

I went into Github, copied my old Gemfile.lock that I wanted and pasted it into my Gemfile.lock in my code and then ran bundle install.

dgreen22
  • 388
  • 4
  • 19
0

I tried to follow the accepted answer but I was still getting errors. This is what worked for me:

git checkout -- Gemfile.lock

And then:

bundle pristine

As described in the Bundler docs, bundle pristine restores installed gems to their pristine condition.

FlavioEscobar
  • 839
  • 1
  • 12
  • 19