Skip to content Skip to sidebar Skip to footer

Writing A Git Post-commit File In Node.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

Solution 1:

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

post-commit:

#!/bin/bash/
node yourJavascriptFile.js

Solution 2:

Use :set filetype=javascript command in vim to set file type. You may also want to enable modeline in vim and include the aforementioned command in a comment at the top of your file like this:

/* vim: set filetype=javascript : */your_Javascript_code_goes_here()

To enable modeline in vim, add this to your ~/.vimrc file:

set modelines=2
set modeline

That will enable searching for vim modelines in the first two lines of the file.

Post a Comment for "Writing A Git Post-commit File In Node.js"