phputil/restage
最新稳定版本:v0.4.1
Composer 安装命令:
composer require phputil/restage
包简介
Add only modified files to the staging area
README 文档
README
✅ Add only modified files to the staging area
Use case: You're using Git and your files are ready to commit. But when you run git commit, your pre-commit Git Hook runs a formatting tool that changes your files again. Now you have to run git add again, but only for the changed files, since you don't want to add untracked files yet. That's boring, I know. Fortunately, now you can use restage for that.
👉 restage adds only modified files to the staging area.
Note: There are similar tools for JavaScript, such as lint-staged, that can be used for this purpose. restage aims at projects that do not need to use JavaScript.
Install
Requires only PHP 7.0+ and Git
composer require phputil/restage --dev
Usage
php vendor/bin/restage
You probably want to include the above command into your Git Hook (e.g. pre-commit), to be executed after a command that formats your source code. For instance, php vendor/bin/php-cs-fixer && php vendor/bin/restage.
CLI Options
--help This help. --all, -a List untracked files and modified staged files. --dry-run, -d Simulate the command without actually doing anything. --modified, -m List modified staged files. --verbose, -v Enable verbose mode.
👉 If you wanna run a linter/formatter in modified files, you can use --modified to get them.
Useful tools
- Captain Hook can manage your Git Hooks.
- PHP-CS-Fixer can format your source code.
- PHP Code Sniffer is an alternative to PHP-CS-Fixer.
License
统计信息
- 总下载量: 115
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 5
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-10-16