Git Id Commit In The Footer

Hello,

This forum post will be useful for those people who use Git as SCM for the project, If you don’t

, so there is one more reason to discover and use Git ;)

Did you have the situation when you needed to know exactly what the version of your app is deployed into the production?

Personally, the most simple and powerful approach is using the git id and last commit time in the footer.

In Yii you can do it by installing simple component GitBuildNumberComponent

The screenshot below demonstrates what does this component:

Installation

Copy the GitBuildNumberComponent.php file to your webapp /protected/components/ folder.


wget https://github.com/yev/yiiGitBuildNumber/blob/master/src/GitBuildNumberComponent.php

Configuration instruction

After downloading and installing the component into right place you have to tell yii framework about tne new component:

  1. Edit your webapp

/protected/config/main.php 

file

  1. And add the following somewhere in the components section -

'git'=>array( 'class'=>'GitBuildNumberComponent', )

  1. After this modification your

protected/config/main.php

file may looks like this:

Using scenario example:

If you are interested in the component history and motivation you can find some information in my blog entry