Reputation: 67290
When I "git pull" the project that I'm working on a ton of files sometimes come down from other developers' changes. I would like to be able to mark certain files that I want to be warned about that I might miss in the pages of text during the pull.
For example, if package.json has changed I know that I need to run "npm i" and if one the .sql files have changed I know that I need to run a script to update the DB schema. If I miss these then I can experience problems until I realize what has happened.
A couple of solutions that jump to mind:
The ideal solution would be able to modify the git config file either locally or globally to mark file patterns (same as .gitignore) so that after or during a pull action those files are highlighted for special attention.
Solutions?
Upvotes: 3
Views: 372
Reputation: 23178
Everybody is recommending you to use gits hooks, but I would actually take a build system approach.
For example, if your package.json changes, make a rule on your Makefile that depends on that and the action is to execute the required command.
This way, your system dependencies do not depend on your version control system, and you always see it happening when you call make or whatever build system you use.
Upvotes: 3
Reputation: 9294
You're looking for git hooks. A hook is a script which git runs before or after a command; you can write your own. post-checkout
or post-merge
are probably the hooks to do what you're after, assuming every pull
triggers one of those. As @meagar points out, you can write a script which checks for changes to specific files and then performs the required actions without too much trouble.
Upvotes: 1