Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run external tool before GIT commit in PHPStorm

Our project uses gettext to allow for multiple languages. Further, there is a *.bat and *.sh file, which generates the current POT file both from the PHP files and Smarty templates.

Is there a way to configure PHPStorm to execute an external tool (for example the bat file), before doing a GIT commit? In the commit window, there is only the possibility to execute a tool after commit. However, after doing changes in the code, I would like to update the POT first, then commit the code.

like image 880
waza-ari Avatar asked Jun 13 '26 11:06

waza-ari


1 Answers

That looks like the clean step of a content filter driver:

clean

(image shown in "Customizing Git - Git Attributes", from "Pro Git book")

The commit would trigger the clean script in order to modify the files, before the commit.

The clean script is:

  • declared with git config filter.<filtername>.clean ./<filterscript>
  • used in a .gitattributes file.
like image 91
VonC Avatar answered Jun 15 '26 23:06

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!