10

I'm new to Heroku. After pushing bad code to the server, I used heroku rollback to revert to a previous version. I then tried to clone this rollback to my computer with:

git clone git@heroku.com:<project>.git <dir>

Unfortunately, this clones the corrupted head, not the rollback. Is there a way to actually clone a specific previous version?

friism
  • 19,068
  • 5
  • 80
  • 116
nullnullnull
  • 8,039
  • 12
  • 55
  • 107

1 Answers1

16

When you do rollbacks, the head of your Heroku Git repo will no longer reflect the running state of you app. Check your releases:

$ heroku releases
Rel   Change                   By                    When
----  ----------------------   -------------------   -------------
v52   Config add AWS_S3_KEY    shanley@heroku.com    5 minutes ago
v51   Deploy de63889           kendra@heroku.com     7 minutes ago
v50   Deploy 7c35f77           katie@heroku.com      3 hours ago

The de63889 values are Git commit shas. With those, you can check out that commit locally:

git checkout de63889
friism
  • 19,068
  • 5
  • 80
  • 116
  • The checkout seems to be working, though I'm not sure what exactly it has done. Is it suppose to return the code on my machine to an earlier state? If so, something seems to have gone wrong. Examining several code snippets, none of them have reverted to a prior commit. – nullnullnull Jul 28 '13 at 05:14
  • Nevermind, it actually was reverting. My editor just wasn't updating the code appropriately. After closing and opening it, everything's working fine. Thanks for your help! – nullnullnull Jul 28 '13 at 14:04