10 useful Heroku commands for Ruby on Rails application

Heroku as web hosting platform for Ruby on Rails application has provided its users with many useful commands. Based on my experience so far, here are 10 most useful Heroku commands. Please make sure that you have installed heroku gem before running them.

heroku console
This command will open a Rails console on Heroku. It is the same console as we run Rails console on the local machine. Of course, by using its console, you will be able to execute Ruby on Rails scripts. 

heroku db:pull
This command is for exporting the database from Heroku to your local machine. The destination database is the database defined on database.yml. Make sure you have installed taps gem before running this command. 

heroku db:push
This command is for importing the database to your Heroku application. You can say it is the opposite of the previous command. Make sure you have installed taps gem before running this command. 

heroku logs
This command will display you Heroku application log message. You can add -t parameter behind it. 

heroku rake db:migrate
This command is for running new migration on your Heroku application. Very useful when you added new migration file to modify or create new table. 

heroku releases
This command is to display all release versions of your Heroku application. 

heroku releases:info v24
This command is for showing details info for specific version of your Heroku application. 

heroku restart
This command is for restarting your Heroku application process.

heroku rollback
This command is for rolling back your Heroku application to previous version.

heroku rollback v24
This command is for rolling back your Heroku application to specific version.

I assumed that you use Linux Ubuntu as your development environment. I also assumed that you have installed your Heroku application correctly.

Some of the commands above has been deprecated and new command introduce, read it more at: Update for Heroku commands