# commit-hash

> Get commit hash from a branch name, tag, or reference

Latest version **0.2.4** (published 2017-11-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install commit-hash
pnpm add commit-hash
yarn add commit-hash
bun add commit-hash
```

Provides the command `commit-hash`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.4 |
| Published | 2017-11-05 |
| First published | 2016-07-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Diego Guerra |
| Maintainers | dgoguerra |
| Keywords | git, commit, hash |

## Links

- npm: https://www.npmjs.com/package/commit-hash
- Repository: https://github.com/dgoguerra/commit-hash
- Homepage: https://github.com/dgoguerra/commit-hash#readme
- Issues: https://github.com/dgoguerra/commit-hash/issues
- npm.io page: https://npm.io/package/commit-hash

## Dependencies (4)

- [async](https://npm.io/package/async.md) ^2.5.0
- [debug](https://npm.io/package/debug.md) ^3.1.0
- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [is-function](https://npm.io/package/is-function.md) ^1.0.1

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 0.2.4 (latest) — 2017-11-05
- 0.2.3 — 2017-11-03
- 0.2.2 — 2017-11-03
- 0.2.1 — 2017-10-31
- 0.2.0 — 2017-10-31
- 0.1.3 — 2017-09-29
- 0.1.2 — 2016-07-14
- 0.1.1 — 2016-07-14

## README

## commit-hash

Obtain a repository's commit hash from a branch name, tag, or reference.

### Installation

```
npm install 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

---
_Source: https://npm.io/package/commit-hash · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
