Last active
June 19, 2019 07:40
-
-
Save og24715/29c2d19c899f2ea6b1693a13868ad80c to your computer and use it in GitHub Desktop.
チケット名をコミットメッセージにプレフィックスするやつ
This file contains hidden or 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 | |
const { exec } = require('child_process'); | |
const fs = require('fs'); | |
exec("git branch | grep '^\* '", (err, stdout, stderr) => { | |
const branchName = stdout.replace(/\n$/g, ''); | |
const ticketName = branchName.split('/')[1]; | |
const commitEditMessage = process.argv[2]; | |
const commitMessage = fs.readFileSync(commitEditMessage); | |
fs.writeFileSync(commitEditMessage, `[${ticketName}] ${commitMessage}`); | |
process.exit(0); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment