# git-bundle-sha

> Retrieve the git SHA of the commit that most recently touched a list of files.

Latest version **0.0.2** (published 2014-08-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install git-bundle-sha
pnpm add git-bundle-sha
yarn add git-bundle-sha
bun add git-bundle-sha
```

## 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.0.2 |
| Published | 2014-08-26 |
| First published | 2014-08-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jason Anderson |
| Maintainers | diurnalist |

## Links

- npm: https://www.npmjs.com/package/git-bundle-sha
- npm.io page: https://npm.io/package/git-bundle-sha

## Dependencies (1)

- [bluebird](https://npm.io/package/bluebird.md) ^2.3.0

## Recent versions

- 0.0.2 (latest) — 2014-08-26
- 0.0.1 — 2014-08-22

## README

# git-bundle-sha

[![Build Status](https://travis-ci.org/diurnalist/git-bundle-sha.svg?branch=master)](https://travis-ci.org/diurnalist/git-bundle-sha)

Retrieve the Git SHA of the latest commit that touched any number of files.
Useful in particular with bundling, when you want to identify a collection of files by something like a hash, but tied to something more real (like a Git history.)

## Usage

Install using npm: 

```bash
npm install git-bundle-sha
```

And then require:

```javascript
var gitsha = require('git-bundle-sha');
```

#### With a list of file paths

```javascript
gitsha(['lib/server.js', 'lib/common.js', 'helpers/handlebars.js'], function (err, sha) {
  if (err) throw err;
  console.log('Git SHA: ' + sha);
});
```

#### Without a list (get HEAD SHA)

```javascript
gitsha(function(err, sha) {
  if (err) throw err;
  console.log('HEAD is at ' + sha);
});
```

### Options

#### `force`
Don't read any values from cache (some things, like the submodule list, are cached for performance.) Default = `false`.

#### `length`
Trim the resulting SHA to a specified length. Default = `null` (no trimming.)

## Notes

This works by sub-shelling out to a Git process, so your node process must be able to access
git. This also means that it is tied to your project directory at the moment.

## Questions

#### Is this submodule-aware?

Yes. If you are using submodules, any file nested under that submodule directory will have a last-modified SHA that corresponds to the commit that last updated the submodule in the parent project.

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