glg
Get parsed git log data easily for analysis
Install
glg
needs node >= 6.x.x
$ yarn add glg
Usage
This example uses async/await
, but you can simply use Promise
.
const glg = require('glg');
(async () => {
const results: Array<Commit> = await glg(process.cwd());
})();
By default glg
will use #~#^#
as commit separator and ^^^
as commit info separator. If for some reason your commits contain those characters, it will mess up the parsing. You can change it through 2nd arguments
const options = {
separator: 'xxxx',
infoSeparator: 'yyyy',
};
const results = await glg(process.cwd(), options)
By default glg
will only provides a few info inside a single commit. You can also provides custom commit data map if you want more information on your git log by using commitDataMap
option
const commitDataMap = {
commitHash: "%h",
authorEmail: "%ae",
authorName: "%an",
subject: "%s",
createdDate: "%ad",
publishedDate: "%cd"
};
const results = glg(process.cwd(), { commitDataMap });
Type Definition
type Commit = CommitDataMap & {
changes: Array<Change>,
};
type Change = BasicChange | RenameChange;
type BasicChange = {
type: string,
path: string,
};
type RenameChange = {
type: string,
path: string,
from: string,
};
CLI
$ yarn global add glg
$ glg ~/git/directory
License
MIT