Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

commit-hash

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

commit-hash - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

2

package.json
{
"name": "commit-hash",
"version": "0.1.1",
"version": "0.1.2",
"description": "Get commit hash from a branch name, tag, or reference",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/dgoguerra/commit-hash#readme",

@@ -11,4 +11,29 @@ ## commit-hash

### Usage
```js
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'
});
```
### License
MIT license - http://www.opensource.org/licenses/mit-license.php
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc