1.0.0 • Published 7 years ago

tagged-git-commits v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

tagged-git-commits

Get the commit hash and refs/tags of tagged commits, remote and local

Build Status Build status Coverage Status

Installation

$ npm i tagged-git-commits --save

or

$ yarn add tagged-git-commits

Usage

const taggedCommits = require('tagged-git-commits');

// the latest local tagged commit from process.cwd()
taggedCommits();

// the latest local tagged commit from the repo './path/to/repo'
taggedCommits({
  path: './path/to/repo',
});

// the latest 5 local tagged commits from process.cwd()
taggedCommits({
  lookBehind: 5,
});

// the latest tagged commit from process.cwd() from remote origin
taggedCommits({
  local: false,
});

// the latest tagged commit from process.cwd() from remote anotherOrigin
taggedCommits({
  local: false,
  remote: 'anotherOrigin'
});

// the latest 3 tagged commits from the repo './path/to/repo' from the remote origin
taggedCommits({
  path: './path/to/repo',
  lookBehind: 3,
  local: false,
  remote: 'origin',
});

Returns an Array with objects.

[
  {
    commit: '31107b9051efe17e57c583937e027993860b11a9',
    shortCommit: '31107b9',
    hash: '31107b9051efe17e57c583937e027993860b11a9',
    shortHash: '31107b9',
    version: 'v1.0.0',
   refsTags: 'refs/tags/v1.0.0',
  },
]

LICENSE

MIT © Lukas Aichbauer