title: git commit -am "Commit message" doesn't work properly with vagrant machine
body: <p>I am using Git Bash in Windows 7. For my project I installed VirtualBox and Vagrant on Windows. In my home directory there are some project folders which are synced into the vagrant machine based on nfs. So Vagrant will keep the files synchronous.</p>
  
  <p>The box is a webserver based on debian/contrib-jessie64 with some configurations like Git for several packages to be installed via Composer. Git is for BitBucket purposes only because some packages need an ssh permission. But Git itself is never used by me within the box because it's very slow. Furthermore Git is required to listen to several hooks. The webserver does have PHP and Composer installed but my host machine (Windows) does not. The reason why I didn't install all the stuff on Windows is the circumstance to keep all versions the same on both host and guest machines. I do want the server do all the php stuff for me and that's fine.</p>
  
  <p>So, working with Git on Windows requires git hooks to be configured on Windows as well as for the box. All the hooks, which are listening to changes on Windows, execute the corresponding hook within the vagrant box. All arguments are piped of course.</p>
  
  <p>This is my pre-commit file on Windows</p>
  
  <pre><code>#!/usr/bin/env bash
  coreDirectory="$HOME/projects/foo"
  
  arguments=""
  
  for arg in "$@"
  do
      arguments="$arguments $arg"
  done
  
  cd $coreDirectory &amp;&amp; vagrant ssh -c "cd /home/projects/foo &amp;&amp; 
  ./.git/hooks/pre-commit $arguments"
  </code></pre>
  
  <p>This works fine. The pre-commit file in the box is being executed and triggers a special Executor which calls the ./vendor/bin/phpcs file for code sniffing.</p>
  
  <p>I only want to trigger the code sniffing rules on staged files, so all modified or untracked files which have been added to stage area should be sniffed. This also works fine. The Executor prepares all files with the following command:</p>
  
  <pre><code>git -C /home/projects/foo diff --name-only --diff-filter=AM --cached
  </code></pre>
  
  <p>In Windows adding desired files to staged area with <strong>git add --all</strong> and committing them works properly and the pre-commit hook triggers the pre-commit hook in the box which triggers the CodeSniffer.</p>
  
  <p>But using <strong>git commit -am "Foo bar"</strong> does not work properly with the command above. The hook reacts but the Executor command within the machine, which tries to get the --cached files, returns an empty set. </p>
  
  <p>I assume that either the vagrant box isn't fast enough to move the changed files to the staged area after I have used the <strong>git commit -am</strong> command on Windows or the command <strong>git commit -am</strong> doesn't even move files to staged area.</p>
  
  <p>Do you have any ideas?</p>