leowebguy / git-info
通过twig输出git信息
2.0.0
2024-03-27 02:02 UTC
Requires
- php: ^8.2
- craftcms/cms: ^5.0
Requires (Dev)
- craftcms/ecs: dev-main
- craftcms/phpstan: dev-main
- craftcms/rector: dev-main
- laravel/pint: ^1.14.0
README
通过twig输出git信息
安装
Shell
composer require leowebguy/git-info -w && php craft plugin/install git-info
DDEV
ddev composer require leowebguy/git-info -w && ddev exec php craft plugin/install git-info
用法
{{ craft.git.branch }}
>> 当前分支,例如:stage
{{ craft.git.remoteUrl }}
>> 例如:github.com:leowebguy/git-info.git
{{ craft.git.lastTag }}
>> 例如:3.1.2
{{ craft.git.commitHash }}
>> 最后提交的hash值
{{ craft.git.commitAuthor }}
>> 最后提交者(姓名)
{{ craft.git.commitDate }}
>> 最后提交日期
{% if not craft.app.config.custom.isProd %} <div style="position: fixed; bottom: 1rem; right: 1rem; padding: 6px 10px; text-align: right; border: solid 1px #eee; z-index: 999;"> {{ 'branch: ' ~ craft.git.branch }}<br> {{ 'remote url: ' ~ craft.git.remoteUrl }}<br> {{ 'last tag: ' ~ craft.git.lastTag }}<br> {{ 'commit hash: ' ~ craft.git.commitHash }}<br> {{ 'commit author: ' ~ craft.git.commitAuthor }}<br> {{ 'commit date: ' ~ craft.git.commitDate }} </div> {% endif %}