commit-hash
Obtain a repository's commit hash from a branch name, tag, or reference.
Installation
npm install commit-hash
Usage
var commitHash = require('commit-hash');
commitHash('21f6b', function(err, hash) {
console.log(hash);
});
commitHash('v0.1.0^^', {dir: '/home/dgo/repos/commit-hash'}, function(err, hash) {
console.log(hash);
});
commitHash('origin/tests-unused-branch', {
dir: '/home/dgo/repos/commit-hash',
fetch: true
}, function(err, hash) {
console.log(hash);
});
License
MIT license - http://www.opensource.org/licenses/mit-license.php