Created
January 13, 2018 00:20
-
-
Save neoacevedo/0cd2d421c0e1fc4b588ca6018b6ca4d6 to your computer and use it in GitHub Desktop.
Devuelve el commit actual desde 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
<?php | |
function getVersion() { | |
// por la tilde invertida se puede ejecutar de manera directa el comando. | |
if ($commit = sprintf("%s", `git describe --all --long | cut -d "-" -f 3`)) { | |
return $commit; | |
} else { | |
return "No hay commit"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment