## Heads up!
This helper will only work with node.js >=0.11.12.
## Usage
```js
var hash = require('helper-git-hash');
console.log(hash());
//=> 485e65e0b0b6a901e17c7e47ffc3970912de17bb
```
## Options
### options.short
Get the [--short][short] hash.
**Type**: `boolean`
**Default**: `undefined`
```js
console.log(hash({short: true}));
//=> 485e65e
```
### options.cwd
Specify the `--cwd` to pass to [execSync()][execSync]
**Type**: `string`
**Default**: `process.cwd()`
```js
hash({cwd: './foo'});
```
## Template engine examples
Handlebars
### Handlebars
```js
var handlebars = require('handlebars');
handlebars.registerHelper('hash', require('helper-git-hash'));
var fn = handlebars.compile('{{hash}}');
console.log(fn());
//=> 485e65e0b0b6a901e17c7e47ffc3970912de17bb
```
Get the [--short hash](#optionsshort):
```js
var fn = handlebars.compile('{{hash hashOptions}}');
console.log(fn({hashOptions: {short: true}}));
//=> 485e65e
var fn = handlebars.compile('{{hash short=true}}');
console.log(fn());
//=> 485e65e
```
Set the [cwd](#optionscwd):
```js
var fn = handlebars.compile('{{hash hashOptions}}');
console.log(fn({hashOptions: {cwd: './foo'}}));
var fn = handlebars.compile('{{hash cwd="./foo"}}');
console.log(fn());
```
Assemble
### Assemble
_(The following examples also work with [verb][], [update][], [generate][], or any other app built on [Templates][])_
```js
var assemble = require('assemble');
var app = assemble();
assemble.helper('hash', require('helper-git-hash'));
// Assemble's default engine is handlebars, but you can use any engine
var view = app.view('example.hbs', {contents: '{{hash}}'});
app.render(view, function(err, view) {
if (err) throw err;
console.log(view.contents.toString());
//=> 485e65e0b0b6a901e17c7e47ffc3970912de17bb
});
```
[short]: https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection#_short_sha_1
[execSync]: https://nodejs.org/api/child_process.html#child_process_child_process_execsync_command_options