git-repo-info
Retrieves repo information WITH relying on the git command.
Why another library
There is already a library that works without git
command, but it's tied to git's internal implementation; the code is fussy and hard to understand. I'm reimplementing its functions using basic git
command, which results in MUCH less and cleaner code.
Isn't a library relies on another program's output can be easy broken?
No. There are LOTS of third party git tools that relies on the native git
command. They have been working without problems for years.
Implementation details / git commands used
$ git show --format='%H%n%h%n%cn%n%cI%n%an%n%aI%n%s' -q --encoding=UTF-8
For getting basic info of the last commit. Formating switches used are documented by the offical git docs
$ git symbolic-ref --short HEAD
For getting working branch
$ git describe --tags --long --always
For getting tag info
Usage
var getRepoInfo = require('git-repo-info');
var info = getRepoInfo();
info.branch
info.sha
info.abbreviatedSha
info.tag
info.lastTag
info.commitsSinceLastTag
info.committer
info.committerDate
info.author
info.authorDate
info.commitMessage
License
MIT