Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Use the output of `git status --porcelain` as a commit message. Automatic git commit message.
#!/usr/bin/env node
var childProcess = require('child_process');
var spawn = childProcess.spawn;
function getStatusMessage() {
var bash = spawn('bash');
bash.stdin.end('git status --porcelain');
return new Promise(function (resolve) {
bash.stdout.on('data',function (data) {
resolve(data.toString());
});
});
}
getStatusMessage().then(function (statusMessage) {
var bash = spawn('bash');
bash.stdin.end('git commit -m "'+statusMessage+'"');
bash.stdout.on('data',function (data) {
console.log(data.toString());
});
bash.stderr.on('data',function (data) {
console.log(data.toString());
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.