Last updated October 21, 2019
Whenever you deploy code, change a config var, or modify your app’s add-on resources, Heroku creates a new release and restarts your app. You can view your app’s release history, and temporarily roll back to a previous release in the event of a bad deploy or config change.
Your app’s first release is named
v1, and this number increments with each subsequent release.
In this example, a code deploy creates release
$ git push heroku master ... -----> Compressing... done, 8.3MB -----> Launching... done, v10 http://severe-mountain-793.herokuapp.com deployed to Heroku
As mentioned, releases are also created whenever you modify your app’s config vars or add-on resources.
Listing release history
heroku releases command to see your app’s release history:
$ heroku releases Rel Change By When ---- ---------------------- ---------- ---------- v52 Config add AWS_S3_KEY firstname.lastname@example.org 5 minutes ago v51 Deploy de63889 email@example.com 7 minutes ago v50 Deploy 7c35f77 firstname.lastname@example.org 3 hours ago v49 Rollback to v46 email@example.com 2010-09-12 15:32:17 -0700
The value of the
Change column indicates the cause of each release. For deployments, this value includes the hash of the Git commit that was deployed. Use this hash to correlate changes in a release with changes in your Git repository. For example:
$ git log -n 1 de63889 commit de63889c20a96347679af2c5160c390727fa6749 Author: <firstname.lastname@example.org> Date: Thu Jul 11 17:16:20 2013 +0200 Fixed listing CSS and localization of description.
You can get detailed info on a release with the
heroku releases:info command:
$ heroku releases:info v24 === Release v24 Change: Deploy 575bfa8 By: email@example.com When: 6 hours ago Addons: deployhooks:email, releases:advanced Config: MY_CONFIG_VAR => 42 RACK_ENV => production
If you deploy buggy code to production that you need to roll back, whenever possible you should simply revert the relevant code changes locally with
git revert and redeploy.
If you need to roll back a release due to incorrect configuration or other Heroku-platform-specific issues, you can use the
heroku rollback command. This command rolls your app back to a previous release:
$ heroku rollback v40 Rolled back to v40
If you don’t specify a release number, your app is rolled back by a single release.
heroku rollback command creates a new release. This release copies the compiled slug and config vars (including add-on-related config vars) of the release you are rolling back to.
heroku rollback command does not roll back the state of any of the following:
- Add-on provisioning (provisioned add-ons remain provisioned, and deprovisioned add-ons remain deprovisioned)
- Note that any add-on-related config vars do roll back.
- Your app’s Heroku-hosted Git repository
- Any state stored in add-ons or externally
It is your responsibility to reconcile these resources after rolling back. Consequently, you should use the
heroku rollback command only when absolutely necessary.
Running on a rolled-back release should serve as a temporary fix to a bad deployment. If you are running on a rolled-back release, commit a fix to your encountered issue and push it to Heroku. As always, this updates the
heroku Git remote and creates a new release.