Skip to content

Instantly share code, notes, and snippets.

@neoacevedo
Created January 13, 2018 00:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neoacevedo/0cd2d421c0e1fc4b588ca6018b6ca4d6 to your computer and use it in GitHub Desktop.
Save neoacevedo/0cd2d421c0e1fc4b588ca6018b6ca4d6 to your computer and use it in GitHub Desktop.
Devuelve el commit actual desde PHP
<?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