norwichtech / php-git-branch
PHP 中确定当前 git 分支的库
此包的官方仓库似乎已丢失,因此该包已被冻结。
1.1.2
2017-09-27 10:52 UTC
Requires
- norwichtech/file-wrapper: >=2.1
Requires (Dev)
- phpunit/phpunit: ^6.2
This package is not auto-updated.
Last update: 2020-11-28 10:04:12 UTC
README
我在哪个 git 分支?这一切意味着什么?这个库可能回答了这些热门问题之一或多个。
用法
include('../vendor/autoload.php');
$currentFolder = realpath(dirname(__FILE__)."/../");
$fileWrapper = new \NorwichTech\FileWrapper\FileWrapper;
$gitBranch = new \NorwichTech\PHPGitBranch\GitBranch($currentFolder,$fileWrapper);
$branch = $gitBranch->branch;
echo "This repository is currently working in \033[0;34m[".$branch."]\033[0;39m branch\n";