An open API service indexing awesome lists of open source software.

https://github.com/sheerun/git-commit-id

Returns commit id (commit sha) of git repository. Useful for Next.js or Sentry.
https://github.com/sheerun/git-commit-id

git nextjs sentry webpack

Last synced: 11 months ago
JSON representation

Returns commit id (commit sha) of git repository. Useful for Next.js or Sentry.

Awesome Lists containing this project

README

          

# git-commit-id [![Build Status](https://travis-ci.org/sheerun/git-commit-id.svg?branch=master)](https://travis-ci.org/sheerun/git-commit-id) [![Modern Node](https://img.shields.io/badge/modern-node-9BB48F.svg)](https://github.com/sheerun/modern-node)

> Returns commit id (commit sha) of git repository

This package is fast, has no dependencies, has synchronous API, doesn't require git binary.

Useful e.g. for CI, release for [Sentry](https://github.com/getsentry/sentry-webpack-plugin) or build id for [Next.js](https://github.com/zeit/next.js#configuring-the-build-id)

## Installation

```
yarn add --dev git-commit-id
```

> If you're using [npm](https://www.npmjs.com/) you can use: `npm install --save-dev git-commit-id`.

## Usage

```js
const gitCommitId = require('git-commit-id')

const commitId = gitCommitId()
```

### Custom directory

You can pass `cwd` option to specify custom git directory:

```js
const commitId = gitCommitId({ cwd: __dirname })
```

## License

MIT