<?php

try {
    if( isset( $_GET[ 'branch' ]  ) )
        $cmd = 'git rev-parse --abbrev-ref HEAD';
    else
        $cmd = 'git describe';
    
    echo trim( exec( $cmd ) );
            
} catch ( Exception $e ) {}

?>