Use Git Commit Hooks to Run Composer Install

I know a lot of us have problems remembering to run composer install whenever we checkout a new branch in Vanilla. If this annoys you then you can add a couple of simple scripts to your .git/hooks directory to automatically run commands so you never have to worry about forgetting again. Read on:

  1. Create a file named post-checkout with the following contents:

    #!/bin/sh
    composer install
    
  2. Make this file executable (chmod a+x).

  3. You will also want this to run when you merge so copy the file above to .git/hooks/post-merge.