title: How to commit in the parent project with changes from the submodule using the precommitter hook
body: <p>How to make a commit in the parent project with changes from the submodule using a pre-commit hook?</p>
  
  <p>I am developing a pre-commit hook for the git, modeling the situation when the developer went to his sub-module on his local car - changed the file - went back to the parent project and made git add. and git commit after which this hook worked. The whole text of the hook does not matter, leaving only the desired part.</p>
  
  <p>Using git submodule foreach
  <br>1) appeal to the submodule
  <br>2) I index changes
  <br>3) make a commit
  Actually, when I work out a hook, I see that a new commit was created in the submodule
  In 4 steps I try to index changes in the parent project by simply git add deploy (this is the name of the submodule)</p>
  
  <p>I see two messages at once
  <br>1) that the changes are indexed and they fall into the commit
  <br>2) that there are new commits in the submodule and you need to update (??????) and that there are no changes that will fall into the commit
  Changes to the server do not arrive as can be seen from the screen number 1</p>
  
  <p><a href="https://b.radikal.ru/b12/1812/1b/7d23ee4e948b.jpg" rel="nofollow noreferrer">https://b.radikal.ru/b12/1812/1b/7d23ee4e948b.jpg</a></p>
  
  <p>On the screen number 2
  I am running git status to see these messages again, but there is only one message left - everything is ready and indexed - to commit</p>
  
  <p><a href="https://d.radikal.ru/d13/1812/ad/7c2201d4f68d.jpg" rel="nofollow noreferrer">https://d.radikal.ru/d13/1812/ad/7c2201d4f68d.jpg</a></p>
  
  <p>On screen 3, I perform the commit again and then the commit appears in the parent project</p>
  
  <p><a href="https://b.radikal.ru/b36/1812/2c/3e133ddf3a45.jpg" rel="nofollow noreferrer">https://b.radikal.ru/b36/1812/2c/3e133ddf3a45.jpg</a></p>
  
  <p>The question is why it does not work out the first time? Rummaged the whole stackover. Only started working with submodules. I hope for your help.</p>
  
  <p>Sorry for links, stack tell about 10 reputation.</p>