Skip to content

Instantly share code, notes, and snippets.

@johnpbloch
Created February 7, 2013 03:22
Show Gist options
  • Select an option

  • Save johnpbloch/4728137 to your computer and use it in GitHub Desktop.

Select an option

Save johnpbloch/4728137 to your computer and use it in GitHub Desktop.
Automatically commit changes to .md files in a directory on save using grunt watch.
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
exec: {
commit: {
command: function(grunt){
var d = new Date(),
datetime = d.toString();
return "git add *.md; git commit -m 'Document saved (" + datetime + ")'";
}
}
},
watch: {
files: '*.md',
tasks: 'exec'
},
});
grunt.loadNpmTasks('grunt-exec');
// Default task.
grunt.registerTask('default', 'exec');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment