用いるgit-revision gem.
Gemfile
gem 'git-revision'
app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :set_git_header
private
def set_git_header
response.headers['X-Git-Revision'] = Git::Revision.info[:commit_hash_short]
end
end
置くcustom X-Git-Revision
headerとlast commit sha.