
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
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 3 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.