Skip to content

Instantly share code, notes, and snippets.

@reiaguilera
Forked from lukeocodes/QuickGit.php
Last active August 29, 2015 14:16
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 reiaguilera/82d164c7211e299d63ac to your computer and use it in GitHub Desktop.
Save reiaguilera/82d164c7211e299d63ac to your computer and use it in GitHub Desktop.
<?php
// forked from lukeoliff/QuickGit.php
class QuickGit {
private $version;
function __construct() {
exec('git describe --always',$version_mini_hash);
exec('git rev-list HEAD | wc -l',$version_number);
exec('git log -1',$line);
$this->version['short'] = "v1.".trim($version_number[0]).".".$version_mini_hash[0];
$this->version['full'] = "v1.".trim($version_number[0]).".$version_mini_hash[0] (".str_replace('commit ','',$line[0]).")";
}
public function output() {
return $this->version;
}
public function show() {
echo $this->version;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment