I came across this blog post a couple of weeks ago, Getting efficient when working with Heroku.
The tips are definitely good and can save you some time. However, I think you can save yourself even more time and effort if you use your Git remote name instead of your Heroku application name.
Most of the Heroku cli documentation uses -a or –app to specify the specific application. However, instead of using the app name, you can use -r or –remote to specify the name of a remote.
Knowing this and sticking to some specific naming conventions, you can add the following functions to back or zsh (preferred) profiles:
<p>[View the code](https://gist.github.com/3638694)</p>
You can name your remotes when you create your Heroku app with the –remote parameters. You can also rename a remote at any time with the following:
git remote rename [previoususuallyheroku] production
Using the Code
Now, to run a rake command it is as simple as:
And as a side benefit, deploying now looks like this:
One downside to this approach is you need to execute them from within your app directory. This isn’t an issue for me personally, but you will probably need to stick with the app suggestions in the in link above if you want to be able to execute commands from anywhere on your computer.