GIT预接收钩子
Is there a way to change the file that is being pushed to the server using a server-side pre-receive hook?
Say I want to add something to the end of a file like:
//End of Org
each time someone pushes to my repo.
Is there a way you can change the file coming in using git hooks
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只是为了完整起见:从名称中应该相当明显地看出您所要求的根本是不可能的。
pre-receive
挂钩无法更改任何文件,因为它还没有接收任何文件!Just for completeness sake: it should be rather obvious from the name that what you are asking for, is simply impossible. The
pre-receive
hook cannot change any files, because it hasn't received any yet!我宁愿使用 过滤器驱动程序可以对每个文件的内容进行操作,以检查您的行是否存在,如果不存在,则在结帐步骤中添加它。
这将是:
I would rather use a filter driver which can operate on the content of each file in order to check if your line is there and add it if not, during the checkout step.
That would be: