Currently, most (if not all) of my projects contain a package.json which is frequently modified to manage my dependencies in the project. But when collaborating we usually have to checked with every git pull to see if the package.json has been changed, if so we ensure that that we do a npm install. This in most cases is a bottleneck and frequently leads to errors.
Let’s Automate this Task using Git Hooks
So, we use git hook to trigger npm install if a package.json file has been updated. In the .git/hooks folder you can put a post-merge file containing the following content:
Boom! Job done! Now you do not need to remember steps that are needed to be executed with every git pull.