本文介绍了在node.js中编写一个git post-commit文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



该文件似乎必须命名为 post-commit 放入 .git / hooks 目录中。由于该文件不能有扩展名,因此我的vim编辑器不会持久地给它提供JavaScript语法突出显示,因此我的代码片段都无法工作,并且出现了各种其他挑战。



我能做什么?告诉git运行post-commit.js或者告诉vim认为这个文件是javascript,但是这并不会持续。



想法?



post-commit:

 #!/ bin / bash / 
节点yourJavascriptFile.js


I'm trying to write a git post-commit file in node.js and I'm having trouble.

The file seems to have to be named post-commit in the .git/hooks directory. Since that file can't have an extension, my vim editor won't persistently give it javascript syntax highlighting, and thus none of my snippets work, and a variety of other challenges present themselves.

What can I do? Tell git to run post-commit.js or tell vim to consider this file javascript, but that doesn't persist.

Thoughts?

解决方案

You can have the post-commit file run a separate JavaScript file.

post-commit:

#!/bin/bash/
node yourJavascriptFile.js

这篇关于在node.js中编写一个git post-commit文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 16:13