xwillq/git-stage-editor 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

xwillq/git-stage-editor

最新稳定版本:1.0.4

Composer 安装命令:

composer require xwillq/git-stage-editor

包简介

PHP package for editing staged files in git

关键字:

README 文档

README

When you stage files, git adds them to its object store in .git/objects. So when you edit file in working directory, staged files stay unchanged until you add them with git add. That's cool, until you want to perform some actions on staged files themselves. You can always stash local changes, edit files, stage them, and get changes back from the stash. But this way you might get some merge conflicts when unstaging. This may be fine when you are editing files yourself, but what if you want to edit them with scripts? For example, lint your code with git hooks.

The solution: edit files directly in the staging area. This library can help you do this by retrieving file from stage and presenting temporary file with its contents to you. All you have to do is pass a closure, that will modify this file, and it will be modified and saved back to stage.

Usage

  1. Install git-stage-editor into your project
    composer require --dev xwillq/git-stage-editor
  2. Instantiate GitStagedFileEditor with full path to your git repository
    $editor = new \Xwillq\GitStageEditor\GitStagedFileEditor($git_root);
  3. Run it with your callback
    $editor->execute(function ($file, string $file_path) {
        exec("php vendor/bin/php-cs-fixer fix $file_path");
    });

统计信息

  • 总下载量: 569
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-09-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固