
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
commit-hash
Advanced tools
Obtain a repository's commit hash from a branch name, tag, or reference.
npm install commit-hash
var commitHash = require('commit-hash');
// looking up a short commit hash, in a project in the current directory
commitHash('21f6b', function(err, hash) {
console.log(hash); // => '21f6ba4e644e77d6e20eaa5156a928b6d75fdf76'
});
// looking up a tag with modifiers, in a project somewhere else
commitHash('v0.1.0^^', {dir: '/home/dgo/repos/commit-hash'}, function(err, hash) {
console.log(hash); // => '285d19c23a56662bab97c75b4bfc80a175dfdae2'
});
// looking up a remote branch, after fetching from all remotes
// to ensure the local repo has updated references
commitHash('origin/tests-unused-branch', {
dir: '/home/dgo/repos/commit-hash',
fetch: true
}, function(err, hash) {
console.log(hash); // => '3f07195438a6a846554ed4b8cd7b3223a8c5e91e'
});
MIT license - http://www.opensource.org/licenses/mit-license.php
FAQs
Get commit hash from a branch name, tag, or reference
The npm package commit-hash receives a total of 2 weekly downloads. As such, commit-hash popularity was classified as not popular.
We found that commit-hash demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.