Last active
February 1, 2018 05:15
-
-
Save locnguyen/bd6d69c87582befa295f31f10bd1dd46 to your computer and use it in GitHub Desktop.
Search release branches by git commit messaage
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
const childProcess = require('child_process'); | |
const { exec } = childProcess; | |
exec(`git log --oneline --all --grep "${process.argv[2]}"`, (err, stdout, stderr) => { | |
if (err) { | |
console.error(err); | |
return; | |
} | |
const logResults = stdout.split('\n').filter(out => out.length).map(out => ({ | |
sha: out.slice(0, 8), | |
message: out.slice(9, out.length) | |
})); | |
logResults.map(log => exec(`git branch -r --contains ${log.sha} --list "origin/release/*"`, (err, stdout, stderr) => { | |
if (err) { | |
console.error(err); | |
return; | |
} | |
console.log(JSON.stringify({ | |
sha: log.sha, | |
message: log.message.trim(), | |
branches: stdout.split('\n').filter(out => out.length).map(out => out.trim()) | |
}, null, 4)); | |
})); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment