Showing the git commit SHA that is currently deployed

I cannot count how many times I (or others) have asked the following question:

What is the difference between master and the production version?

We deploy about 3-5 times a day and we merge code about twice as much into master (some days, even more then that).

We deploy to servers with Capistrano, Capistrano has a very useful feature to write a REVISION file to the root of the project, this file contains a single line with the commit sha.

So, I thought I might set up a controller that will read this file and display it when I want.

So, I spec’d it out:

And this is the controller code:


Submit to Hacker News

[NOTE] This post has been imported to Hugo from a Wordpress blog. It may be broken, missing images, code snippets or other information.

[NOTE] updated April 30, 2012. It's 3004 days old . This article may have outdated content.