git-head
Version:
finds the hash of the HEAD reference
18 lines (13 loc) • 339 B
JavaScript
var gitRefs = require('git-refs')
module.exports = function (root, cb) {
if (typeof root === 'function') {
cb = root
root = '.git'
}
if (typeof cb !== 'function') throw new Error('no callback provided')
gitRefs(root, function (err, data) {
if (err) return cb(err)
cb(null, data.get('HEAD'))
})
}