Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view remote Git revision on Heroku

For deploying to Heroku, I use git push heroku master. But how do I see which revision I pushed up to heroku? (I'm often in doubt if I pushed the recent version up)

For those not familiar with it, Heroku's create script generates a remote git repository that you push to. Upon push, the code is deployed magically.

Heroku adds a remote repository to the local one in the form:

$ git remote add heroku [email protected]:appname.git 

More info in Heroku's manual "Deploying with Git"

Question is: How can I see latest version in Heroku repository?

like image 500
Jesper Rønn-Jensen Avatar asked Feb 17 '10 15:02

Jesper Rønn-Jensen


People also ask

How do I view a remote git?

To view your remote branches, simply pass the -r flag to the git branch command. You can inspect remote branches with the usual git checkout and git log commands. If you approve the changes a remote branch contains, you can merge it into a local branch with a normal git merge .

How do I find my Heroku git 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.


2 Answers

The correct answer is actually so simple. You don't need to checkout anything, neither do you have to resort to COMMIT_HASH hacks (which don't work on Cedar stack). All you need to do is: git ls-remote <remote>

 > git ls-remote heroku ddaszxcewb585d3a3c00de816a197b14462791a3        HEAD ddaszxcewb585d3a3c00de816a197b14462791a3        refs/heads/master 
like image 105
dolzenko Avatar answered Oct 02 '22 16:10

dolzenko


If you've just pushed and want to make sure you're up-to-date, then you can just run git remote show heroku and you'll see output similar to this:

* remote heroku   Fetch URL: [email protected]:XXX.git   Push  URL: [email protected]:XXX.git   HEAD branch: master   Remote branch:     master tracked   Local ref configured for 'git push':     master pushes to master (up to date) 

That (up to date) at the end will be replaced by (fast forwardable) if it is not up to date.

Or, if you're wanting to see the full commit log for the heroku remote, the only way I know how is to check it out first. git checkout heroku/master will give you the current commit hash and commit comment: HEAD is now at <short commit hash>... <commit comment>, and git log will give you the rest of the story.

like image 45
Brock Batsell Avatar answered Oct 02 '22 16:10

Brock Batsell