- BASICS
- States
- Ignore
- Remove
- Reset
- Restore
- BRANCH
- Create Branch
- Merge Branch
- Force Merge
- Undo Merge
-
Php Branch
- Diff
- UNDO
- Push Force
- Exclude Files
- GITHUB
- Hooks
- Repository
- Authentication
Name
Show git branch in Php
php
public function git_branch()
{
$branch = NULL;
$file = dirname(__FILE__) . "/../.git/HEAD";
if(@file_exists($file)) {
$fd = file($file, FILE_USE_INCLUDE_PATH);
$tmp = explode("/", $fd[0]);
$branch = trim($tmp[2]);
}
return $branch;
}
echo git_branch();
Last update: 533 days ago