Created
July 12, 2017 16:55
-
-
Save jairoFernandez/f20075080c388683094193f8fe9d8bf6 to your computer and use it in GitHub Desktop.
Obtain_last_version_git_PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function ObtainLastVersionCode($directoryCode) | |
{ | |
try{ | |
$dir = $directoryCode; | |
chdir($dir); | |
$version = 'git rev-parse --verify HEAD'; | |
$comment = 'git log -1 --pretty=%B'; | |
$date = 'git log -1 --format=%cd --date=local'; | |
$outputVersion = shell_exec($version); | |
$outputComment = shell_exec($comment); | |
$outputDate = shell_exec($date); | |
return ['Version'=>$outputVersion, 'Comment'=>$outputComment, 'Date'=>$outputDate]; | |
}catch (Exception $e){ | |
return $e; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment