On Sun, Aug 9, 2009 at 10:17 AM, Casper
Fabricius<[email protected]> wrote:
> Hi,
>
> I know the Heroku guys (or at least Morten) probably thinks I'm
> thinking too much in the "old" Capistrano terms, and that Heroku aims
> to ensure that a deploy with errors should never get out there. Until
> that happens, however, I'd like to be able to rollback my application
> code on Heroku to a previous version.
>
> I believe the easiest way to do that is to tag each release, but (and
> maybe this is really more of a Git than a Heroku question) I don't how
> I'd make the remote Heroku repository "rollback" to a tag, while
> keeping my local repository at HEAD. Is there a way? Does it makes
> sense at all to get some peace of mind like this? :)
>
> What do other people do for this?
You can roll back to a specific branch, tag, or even commit SHA with
"git push -f". e.g., if you have the version you want to roll back to
tagged as "previous":
git push -f heroku previous:master
Or, you want to roll back three commits:
git push -f heroku HEAD~3:master
Sometimes I just browse `git log' until I find the commit I want to go
back to and then use the short SHA:
git push -f heroku a3fe67b:master
This won't effect your working copy at all.
This isn't exactly like capistrano's rollback, though. No attempt is
made to rollback database migrations or anything like that. You will
need to do that manually before pushing the previous version.
Something like the following IIRC:
heroku rake db:migrate VERSION=20090901123000
git push -f heroku old-version:master
Really insanely useful technique. We should document that somewhere.
Thanks,
Ryan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Heroku" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en
-~----------~----~----~----~------~----~------~--~---