title: Git add in pre-commit hook not staging file for commit
body: <p>I have written a pre-commit hook that compiles my project and adds the generated file to the commit.</p>
  
  <p>This is a JavaScript project and I am using husky, but I have experimented with editing the .git/hooks/pre-commit as well and the file is not getting added to the commit. If I cancel the commit, I can see the file has been added, but for some reason this is not applying to the current commit.</p>
  
  <p>My pre-commit hook looks something like:</p>
  
  <pre><code>const shell = require('shelljs');
  
  shell.exec('yarn bundle');
  shell.exec('git add dist');
  shell.exit(0);
  </code></pre>
  
  <p><code>shelljs</code> is just a library to execute cross-OS unix commands in node</p>
  
  <p>I edited the <code>.git/hooks/pre-commit</code> to run <code>git add dist</code> and the file is still not added to the commit</p>