Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine which commit and/or which branch was deployed to Heroku?

I have an app that is deployed to Heroku, and presume that I haven't done the deployment, how can I check which branch was used to deploy to heroku, or what is the commit ID (as with it I can determine the branch if needed)?

I am using GitHub.

So far I have tried to run in console:

$ heroku releases

and then running the:

$ heroku releases:info v123

But it didn't show anything.

How can I determine the commit or branch name from the deployed app on heroku?

It is a Rails app (maybe it might help to determine this information)

like image 551
Aleks Avatar asked Jul 18 '16 10:07

Aleks


People also ask

How do you check which branch is deployed on Heroku?

To see what's been deployed on the Heroku dashboard: Just click the Overview tab. You'll see an Activity view on the right that shows recent deployments with commit hashes.

Which branch does Heroku use when deploying code?

Heroku manages most app deployments with Git, the popular version control system.

How can I see Heroku deployed code?

Just go to https://dashboard.heroku.com/apps/YOUR_APP_NAME/deploy/heroku-git. If you haven't already, log in to your Heroku account and follow the prompts to create a new SSH public key. Use Git to clone YOUR_APP_NAME's source code to your local machine.

Can I deploy from branch to Heroku?

To deploy your app to Heroku, use the git push command to push the code from your local repository's main branch to your heroku remote. For example: $ git push heroku main Initializing repository, done.


2 Answers

The "releases" feature does not help you because it's an internal counter Heroku is using to keep track of pushes and re-configuration.

If you re-configure your app, the counter will increase. Deployments will also increase the counter but that doesn't help you.

But remember that Heroku is just another "git remote." So if you are on the machine which you used to deploy, there must be this:

$ git remote show heroku
* remote heroku
  Fetch URL: https://git.heroku.com/your-app-3367.git
  Push  URL: https://git.heroku.com/your-app-3367.git
  HEAD branch: master
  Remote branch:
    master tracked
  Local ref configured for 'git push':
    master pushes to master (up to date)

If you have a similar output, you can just:

git show heroku/master

and see the commit that was pushed and deployed most recently.

like image 106
awendt Avatar answered Nov 11 '22 04:11

awendt


To see what's been deployed on the Heroku dashboard: Just click the Overview tab. You'll see an Activity view on the right that shows recent deployments with commit hashes.

like image 30
Freewalker Avatar answered Nov 11 '22 06:11

Freewalker