How to make a commit in the parent project with changes from the submodule using a pre-commit hook?
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.
Using git submodule foreach
1) appeal to the submodule
2) I index changes
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)
I see two messages at once
1) that the changes are indexed and they fall into the commit
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
https://b.radikal.ru/b12/1812/1b/7d23ee4e948b.jpg
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
https://d.radikal.ru/d13/1812/ad/7c2201d4f68d.jpg
On screen 3, I perform the commit again and then the commit appears in the parent project
https://b.radikal.ru/b36/1812/2c/3e133ddf3a45.jpg
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.
Sorry for links, stack tell about 10 reputation.