Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git warnings when certain files have changed

Tags:

git

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:

  • Wrap git in a script that does this. Yes, that would work but would be less portable as I'd have to carry that script from machine to machine and might forget to do it.
  • Get into the habit of always running my post pull scripts even if they're not needed. This takes time.

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?

like image 874
Guy Avatar asked Sep 27 '26 14:09

Guy


1 Answers

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.

like image 139
Arkaitz Jimenez Avatar answered Sep 29 '26 11:09

Arkaitz Jimenez



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!