Last active
November 18, 2019 14:48
-
-
Save pi0/b5462317693bea6c0f019935791a1e8b to your computer and use it in GitHub Desktop.
Get git commit in one line!
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 gitCommit = process.env.GIT_COMMIT || require('child_process') | |
.spawnSync('git', ['rev-parse', '--short', 'HEAD'], { encoding: 'utf8' }) | |
.stdout.slice(0, -1) | |
console.log(gitCommit) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment