I am currently working on implementing a pre-commit hook with grunt git hooks. I am new to using this plugin and it's a bit unclear if I can use this plugin to do what I initially set out to do.
Currently, I have two grunt tasks triggering for every git commit as below.
githooks: {
all: {
'pre-commit' : 'compass requirejs'
}
}
Above generates git pre-commit hook as below.
#!/usr/bin/env node
// GRUNT-GITHOOKS START
var exec = require('child_process').exec;
exec('grunt compass requirejs', {
cwd: 'C:\\development\\Sourcecode\\qnb-home'
}, function (err, stdout, stderr) {
console.log(stdout);
var exitCode = 0;
if (err) {
console.log(stderr);
exitCode = -1;
}
process.exit(exitCode);
});
// GRUNT-GITHOOKS END
Whilst above ensure the tasks are been run before the git commit, it does not add the newly created minified files (compiled SASS and r.js files) to the existing commit.
So ,I would like to add a git add --all
to the pre-commit hook using grunt githooks. Is it this possible to do? Any comment/answer would be highly appreciated.