https://github.com/leowebguy/git-info
https://github.com/leowebguy/git-info
craft-cms craft-cms-plugin craft4 craft5 craftcms craftcms-plugin
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/leowebguy/git-info
- Owner: leowebguy
- Created: 2023-11-29T21:52:05.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-27T03:47:20.000Z (about 2 years ago)
- Last Synced: 2025-05-26T20:09:01.049Z (about 1 year ago)
- Topics: craft-cms, craft-cms-plugin, craft4, craft5, craftcms, craftcms-plugin
- Language: PHP
- Homepage:
- Size: 27.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
Git Info plugin for Craft
===
Output git info over twig
### Installation
Shell
```shell
composer require leowebguy/git-info -w && php craft plugin/install git-info
```
DDEV
```shell
ddev composer require leowebguy/git-info -w && ddev exec php craft plugin/install git-info
```
### Usage
`{{ craft.git.branch }}` >> current branch, i.e: stage
`{{ craft.git.remoteUrl }}` >> i.e: github.com:leowebguy/git-info.git
`{{ craft.git.lastTag }}` >> i.e: 3.1.2
`{{ craft.git.commitHash }}` >> last commit hash
`{{ craft.git.commitAuthor }}` >> last commit author (name)
`{{ craft.git.commitDate }}` >> last commit date
```twig
{% if not craft.app.config.custom.isProd %}
{{ 'branch: ' ~ craft.git.branch }}
{{ 'remote url: ' ~ craft.git.remoteUrl }}
{{ 'last tag: ' ~ craft.git.lastTag }}
{{ 'commit hash: ' ~ craft.git.commitHash }}
{{ 'commit author: ' ~ craft.git.commitAuthor }}
{{ 'commit date: ' ~ craft.git.commitDate }}
{% endif %}
```
