Showing the git commit SHA that is currently deployed

Posted on Apr 30, 2012

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: