git-revision

Simple node module for git revision information

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
git-revision
100.0.28 years ago9 years agoMinified + gzip package size for git-revision in KB

Readme

git-revision
Simple node module for git revision information
Circle CI npm version
NPM
General Info
This module provides an simple API for both synchronous and asynchronous fetching of git revision information. Note: this module requires Node 0.12 for the execSync method

Methods

short

Returns the short form of a the current git hash
Example: f1079c1

long

Returns the short form of a the current git hash
Example: f1079c100a1889a3c75f8de650582bd5b936594c

hash

Alias of long

tag

Returns the current tag. If there is no tag, this will return the full hash (just as if you called long)
Example: f1079c100a1889a3c75f8de650582bd5b936594c or 0.0.1

branch

Returns the current branch
Example: master
Examples
var gitRevision = require('git-revision')


// Get the current short git hash

  // Synchronously
  var shortHash = gitRevision("short")

  // Asynchronously
  gitRevision("short", function (hash) {
    var hash = hash
  })

// Get the current tag

  // Synchronously
  var tag = gitRevision("tag")

  // Asynchronously
  gitRevision("tag", function (tag) {
    var tag = tag
  })