oblik/kirby-git
Composer 安装命令:
composer require oblik/kirby-git
包简介
Shows you Git changes in the Kirby panel and allows you to add/commit/push them, manually or automatically.
关键字:
README 文档
README
For contributing instructions, please check CONTRIBUTING.md. Thanks!
Note: Once the Kirby 3.6 docs come up (especially the UI Kit ones), I'll be able to invest some time and add a few features I've planned for a while.
Kirby Git
Shows you Git changes in the Kirby panel and allows you to add/commit/push them, manually or automatically.
Installation
With Composer:
composer require oblik/kirby-git
Note: This plugin requires Git version 2.22.0 or above. Check how to update it on your server here.
Usage
In order to work successfully with this plugin (and Git in general), you need separate branches in order to avoid overwriting history.
Let's say your repository is hosted on GitHub. This means you have a remote called origin and it points to that GitHub repo. Example setup:
liveis the branch that is checked out on the live server. Content changes are pushed toorigin/livefrom the panel via this plugin. You should never push toorigin/liveby other means. This would allow editors to always be able to commit and push new changes.devis the branch where you do development work locally on your machine. You can freely make both site changes and content changes and push them toorigin/devfor other developers to pull.masteris where you merge the other two branches. You pull content changes fromorigin/live, merge them with your local changes ondev, resolve conflicts locally, and push toorigin/master.
Whenever someone in the panel issues a pull, the origin/master branch will be fetched and merged with the local live on the server if, and only if a fast-forward merge is possible. This means that if there are changes on live that are not reflected on origin/master, the merge will fail.
Example flow:
- You push C1 (commit 1) and C2 from your
devtoorigin/dev - Editors push C3 and C4 from
livetoorigin/live - You pull C3 and C4 from
origin/liveto your locallive - You merge your
masterwith yourdevand yourlive, resulting in a merge commit C5 - Your
masternow has all C1, C2, C3, and C4 and you push it toorigin/master - Editors will be able to pull
origin/masterand fast-forward to C5, which has your C1 and C2
If editors created a new commit C6 on their live before merging with origin/master, the merge would have failed because C6 does not yet exist on origin/master. So they push C6 to origin/live, you pull it, merge it with master, and push it to origin/master. After that, editors would be able to pull.
Config
The plugin expects a repo to already be initialized and set up. You just give a path to that repo and check out the branch it should use.
Options for the plugin are specified with dot notation in site/config/config.php. For example:
return [ 'oblik.git.repo' => '/path/to/repo', 'oblik.git.merge' => 'master', ... ];
bin
What executable to use. You might need to specify this option if there are multiple versions of Git on the machine.
Default: git
repo
Path to a folder containing a Git repo (a .git folder).
Default: kirby()->root('index') (the project folder)
remote
What remote to use for pulling from and pushing to remote branches.
Default: origin
merge
What branch to be used for merging when issuing a pull.
Default: master
hooks
An array of Kirby hooks to use as a trigger for git add and git commit. Example:
return [ 'oblik.git.hooks' => [ 'site.update:after', 'page.update:after' ] ];
With the above config, a new commit will be created any time a page or the site object is updated. However, this could bloat your repository with hundreds (or even thousands) of commits. You could use a hook like user.login:after that gets triggered more rarely.
Default: null
log
Absolute path to a file where each command executed by this plugin will be logged. Example:
return [ 'oblik.git.log' => '/path/to/kirby-git.log' ];
Logs will look like this:
git -C /var/www/site status -u --porcelain 2>&1
git -C /var/www/site rev-list --count master 2>&1
git -C /var/www/site log origin/master..master --format=%h 2>&1
git -C /var/www/site log master --pretty=format:"%h|%an|%ae|%ad|%s" --skip="0" --max-count="15" 2>&1
...
Default: false
Section
For displaying a summary of Git changes, you could use the git section in a blueprint:
title: Page sections: changes: type: git headline: Git Status
View
In the panel view, you can add, commit, and push changes in a very simple manner. Just three columns and three buttons:
REST API
The plugin uses Kirby's REST API to provide a means for the panel view to communicate with PHP. You can use it as well! Check the various routes here.
API
You can work with Git via the Git class as well. For example:
use Oblik\KirbyGit\Git; $git = new Git(); $git->add(); $git->commit('my message'); $git->push();
oblik/kirby-git 适用场景与选型建议
oblik/kirby-git 是一款 基于 Vue 开发的 Composer 扩展包,目前已累计 10.38k 次下载、GitHub Stars 达 83, 最近一次更新时间为 2020 年 04 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「kirby」 「kirby-plugin」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 oblik/kirby-git 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 oblik/kirby-git 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 oblik/kirby-git 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Zero-dependency global `kirbylog()` helper for any content
Courier offers a convenient and painless solution for creating emails tailored for your Kirby website.
Blade template for Kirby
Search Kirby with Loupe
Email+ extends Kirby's email capabilities by adding support for multiple email services using the same Kirby email API.
X-Ray provides a comprehensive overview of the content present on your site and individual pages, allowing you to inspect and evaluate them at a glance.
统计信息
- 总下载量: 10.38k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 83
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-04-11


