Skip to content

Instantly share code, notes, and snippets.

@jbrooksuk
Created February 12, 2013 09:47
Show Gist options
  • Save jbrooksuk/4761242 to your computer and use it in GitHub Desktop.
Save jbrooksuk/4761242 to your computer and use it in GitHub Desktop.
PHP Working Git Branch
<?php
$_gitHead = file('.git/HEAD', FILE_USE_INCLUDE_PATH);
$_gitHead = $_gitHead[0];
$_gitString = explode("/", $_gitHead);
$_gitBranchName = trim($_gitString[2]);
printf("<h4>Working Git Branch:</h4> <strong>&raquo; %s</strong>", $_gitBranchName);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment