Run a command if a file changes via Git hooks. Useful for lock files or build systems to keep dependencies and generated files up to date when changin

Search code, repositories, users, issues, pull requests...

submited by
Style Pass
2024-12-14 16:00:08

Run a command if a file changes via Git hooks. Useful for lock files or build systems to keep dependencies and generated files up to date when changing branches, pulling or commiting.

run-if-changed is functional as-is, but it's still quite basic and rough as it has just been published. So issues, feature requests and pull requests are most welcome!

The use case for run-if-changed is mostly for a team working on a project and push and pull code in different branches. When you share dependencies, database migrations or compilable code in the shared Git repository often some commands need to be run when a file or folder gets updated.

Configuration should be an object where each key is a file or directory match pattern and the value is either a single command or an array of commands to run if the file have changed since the last Git operation.

run-if-changed is using execa to locate locally installed scripts and run them. So in your .run-if-changedrc you can just write and it would use the local version:

Leave a Comment