Zdobądź gałęź git z php
function get_current_git_branch(){
$fname = sprintf( '.git/HEAD' );
$data = file_get_contents($fname);
$ar = explode( "/", $data );
$ar = array_reverse($ar);
return trim ("" . @$ar[0]) ;
}
function get_current_git_datetime( $branch='master' ) {
$fname = sprintf( '.git/refs/heads/%s', $branch );
$time = filemtime($fname);
if($time != 0 ){
return date("Y-m-d H:i:s", $time);
}else{
return "time=0";
}
}
Tiago F2