git-commit-id
v2.0.1
Published
Returns commit id (commit sha) of git repository
Downloads
15,769
Readme
git-commit-id
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 or build id for Next.js
Installation
yarn add --dev git-commit-id
If you're using npm you can use:
npm install --save-dev git-commit-id
.
Usage
const gitCommitId = require('git-commit-id')
const commitId = gitCommitId()
Custom directory
You can pass cwd
option to specify custom git directory:
const commitId = gitCommitId({ cwd: __dirname })
License
MIT