Modify file before commit with pre
I am trying to write a pre-commit hook that modify a line in my code but I do not know even from where to start.
The problem is:
I have a KEY
public static final String APP_KEY = ""; //DELETE THE KEY BEFORE COMMIT!!!
In order to avoid publishing the KEY to the repository I've think maybe git hooks are the thing we need instead of delete the key manually. I've take a look at Customizing git hooks but I do not know how to write the hook.
Is there a way to before commit the changes, delete the KEy and after the commit write the key again?
That would be done with a content filter driver :
(image from "Customizing Git Attributes" from the Git Book)
See an example of how those filters are declared in "Can git automatically switch between spaces and tabs?"
链接地址: http://www.djcxy.com/p/80830.html上一篇: “localhost”vs“127.0.0.1”的表现
下一篇: 在提交pre之前修改文件