JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 261195
  • Score
    100M100P100Q175724F
  • License MIT

Synchronously get the current git commit hash, tag, or branch

Package Exports

  • git-rev-sync

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (git-rev-sync) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

git-rev-sync

Build Status

Synchronously get the current git commit hash, tag, branch or commit message. Forked from git-rev.

Example

var git = require('git-rev-sync');

console.log(git.short());
// 75bf4ee

console.log(git.long());
// 75bf4eea9aa1a7fd6505d0d0aa43105feafa92ef

console.log(git.branch());
// master

console.log(git.message());
// initial commit

console.log(git.tag());
// v1.3.1

console.log(git.log());
// not implemented

You can also run these examples via: npm run examples

Install

npm install git-rev-sync --save

API

var git = require('git-rev-sync');

git.short() → <String>

return the result of git rev-parse --short HEAD

git.long() → <String>

return the result of git rev-parse HEAD

git.branch() → <String>

return the current branch

git.tag() → <String>

return the current tag; this method will fail if the git command is not found in your PATH

git.message() → <String>

return the current commit message; this method will fail if the git command is not found in your PATH

License

MIT