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
Synchronously get the current git commit hash, tag, or branch. 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.tag());
// 0.1.0
console.log(git.log());
// [
// [
// '75bf4eea9aa1a7fd6505d0d0aa43105feafa92ef',
// 'update pjson to include sync exec',
// '17 minutes ago',
// 'kurttheviking'
// ],
// [
// '143120ac3ecc07aeae1462b372bb2033aa20c3ee',
// 'Merge pull request #6 from shtylman/patch-1',
// '1 year, 2 months ago',
// 'Thomas Blobaum'
// ],
// ...
// ]
You can also run these examples via: npm run examples
Install
npm install git-rev-sync --save
Methods
var git = require('git-rev-sync');
.log() => <Array: <Tuple>>
return the git log of process.cwd()
as an array; each array contains the long commit hash, commit message, fuzzy commit time, and user
.short() => <String>
return the result of git rev-parse --short HEAD
.long() => <String>
return the result of git rev-parse HEAD
.tag() => <String>
return the current tag
.branch() => <String>
return the current branch
Warning
Not tested outside of a *nix system. See the execSync module notes on this topic.