Skip to content

Instantly share code, notes, and snippets.

@pi0

pi0/git_commit.js

Last active Nov 18, 2019
Embed
What would you like to do?
Get git commit in one line!
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