运行 在 PHPStorm 中提交 GIT 之前的外部工具

Run external tool before GIT commit in PHPStorm

我们的项目使用 gettext 来支持多种语言。此外,还有一个 *.bat 和 *.sh 文件,它们从 PHP 文件和 Smarty 模板生成当前的 POT 文件。

有没有办法配置 PHPStorm 以执行外部工具(例如 bat 文件), 执行 GIT 提交之前?在提交window中,只有在提交后执行工具的可能性。但是,在更改代码后,我想先更新 POT,然后再提交代码。

看起来像 clean step of a content filter driver:

(图片显示在“Customizing Git - Git Attributes", from "Pro Git book”)

提交将触发 clean 脚本以修改文件, 提交之前。

clean 脚本是:

  • git config filter.<filtername>.clean ./<filterscript>
  • 声明
  • 用于.gitattributes file