Created
January 22, 2019 16:43
Use the output of `git status --porcelain` as a commit message. Automatic git commit message.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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