Get the commit hash and refs/tag of tagged commits, remote and local
$ npm i tagged-git-commit --save
or
$ yarn add tagged-git-commit
Returns an array of the commit hashes.
const taggedCommits = require('tagged-git-commit');
// the latest local tagged commit hash from process.cwd()
taggedCommits();
// the latest local tagged commit hash from the repo './path/to/repo'
taggedCommits({
path: '.path/to/repo',
});
// the latest 5 local tagged commit hashes 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 commit hashes from the repo './path/to/repo' from the remote origin
taggedCommits({
path: './path/to/repo',
lookBehind: 3,
local: false,
remote: 'origin',
});
MIT © Lukas Aichbauer