close

PHP的exec會回傳執行結果,可以簡單的利用以下的方式取得git的hash版本號:

exec('/usr/bin/git describe --always',$version_mini_hash);
exec('/usr/bin/git rev-list HEAD | /usr/bin/wc -l',$version_number);
$version['short'] = $version_mini_hash[0];
$version['full'] = trim($version_number[0]).".$version_mini_hash[0] (".str_replace('commit ','',$line[0]).")";

 

arrow
arrow
    文章標籤
    php git 版本號
    全站熱搜

    Matt 發表在 痞客邦 留言(0) 人氣()