Skip to content

Instantly share code, notes, and snippets.

View menthays's full-sized avatar

Hao Yang menthays

  • China, Shanghai
View GitHub Profile
@menthays
menthays / getGitCommitId.js
Created June 19, 2019 03:24
a function (nodejs) to get git commit id
const child_process = require('child_process')
const getGitCommitId = (short = true) => {
return new Promise((resolve, reject) => {
const p = child_process.exec(`git rev-parse ${short?'--short':''} HEAD`)
p.stdout.on('data', resolve)
p.stderr.on('data', reject)
})
}