Getting Started
Login
heroku loginLog in to your Heroku account from the command line.
Logout
heroku logoutLog out from your Heroku account.
App Management
Create an App
heroku create [app-name]Create a new Heroku app. The app name is optional.
List Apps
heroku appsList all Heroku apps you have access to.
Rename an App
heroku apps:rename new-nameRename an existing app.
Delete an App
heroku apps:destroy --app app-namePermanently delete an app.
Configuration
View Config Vars
heroku configDisplay all configuration variables for an app.
Set a Config Var
heroku config:set KEY=valueSet a configuration variable.
Unset a Config Var
heroku config:unset KEYRemove a configuration variable.
Deploying Code
Deploy with Git
git push heroku mainPush code from your local repository to Heroku (assuming main is your default branch).
Rollback
heroku rollbackRoll back to the previous release.
Releases
heroku releasesList recent releases.
View Logs
heroku logs --tailStream logs from your app in real-time.
Add-ons
List Add-ons
heroku addonsList all add-ons for an app.
Add an Add-on
heroku addons:create addon-nameAdd an add-on to your app.
Remove an Add-on
heroku addons:destroy addon-nameRemove an add-on from your app.
Dyno Management
Scale Dynos
heroku ps:scale web=1Scale the number of web dynos to 1.
View Dyno Status
heroku psList dynos for an app and their current status.
Restart Dynos
heroku ps:restartRestart all dynos for an app.
Database Management
List Databases
heroku pgList all Heroku Postgres databases for an app.
Open PostgreSQL Console
heroku pg:psqlOpen an interactive console to the database.
Backup Database
heroku pg:backups:captureCapture a backup of your database.
Restore Database
heroku pg:backups:restore BACKUP_URL DATABASERestore a database from a backup URL.
Collaborators
Add a Collaborator
heroku sharing:add email@example.comAdd a collaborator to your app.
Remove a Collaborator
heroku sharing:remove email@example.comRemove a collaborator from your app.
Additional Commands
Open App in Browser
heroku openOpen the app in your default web browser.
Run a Command
heroku run commandRun a one-off command in your app environment.
Maintenance Mode
heroku maintenance:onEnable maintenance mode.
heroku maintenance:offDisable maintenance mode.
Help
Command Help
heroku help commandDisplay help for a specific command.
This cheat sheet provides a quick reference for the most essential Heroku CLI commands. You can always use heroku help for more detailed information about specific commands or visit the Heroku CLI documentation for more comprehensive details.
Discussion 0
Please sign in to join the discussion.
No comments yet. Start the discussion!