Pre-commit hook file staging for commit

浪子不回头ぞ 提交于 2019-12-02 08:52:55

Yes, you would have to add the file yourself to the index.
The pre-commit hook allows you to run some commands before committing, that doesn't mean that git will keep track of the modifications made by your hook (or anything external).

That being said, I cannot recommend this kind of practice. Even if it isn't exactly the same thing, it's similar to compile your application and add the result of the compilation to your commit on the fly.

In my opinion, the automatic changes of your code should be done during your build or before your deployment and should have nothing to do with your VCS.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!