https://github.com/jamiemason/giterator
`git log` as a JavaScript generator
https://github.com/jamiemason/giterator
generator git git-log iterator
Last synced: about 1 month ago
JSON representation
`git log` as a JavaScript generator
- Host: GitHub
- URL: https://github.com/jamiemason/giterator
- Owner: JamieMason
- License: mit
- Created: 2023-02-21T17:43:33.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-21T21:12:56.000Z (over 2 years ago)
- Last Synced: 2025-04-28T16:19:17.088Z (about 2 months ago)
- Topics: generator, git, git-log, iterator
- Language: TypeScript
- Homepage:
- Size: 67.4 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# giterator
> `git log` as a JavaScript generator
## Installation
```
npm install --save giterator
```## Usage
```js
import { giterator } from 'giterator';for await (const commit of giterator('/Users/foldleft/Dev/syncpack', {
pageSize: 20,
skipMerges: true,
tokenNames: ['authorName', 'subject', 'refNames'],
})) {
console.log(commit);
}
```Our example would produce;
```
{
authorName: 'Jamie Mason',
subject: 'chore(license): update year',
refNames: 'HEAD -> master, origin/master, origin/HEAD'
}
{
authorName: 'Jamie Mason',
subject: 'chore(release): 9.8.4',
refNames: 'tag: 9.8.4'
}
{
authorName: 'Jamie Mason',
subject: 'docs(site): mark up required/optional config',
refNames: 'origin/dev, dev'
}
{
authorName: 'Jamie Mason',
subject: 'feat(semver): support resolving with lowest version',
refNames: ''
}
// ...etc
```## Options
### `directory` string
Absolute path to your locally cloned git repository.
### `options.tokenNames` string[]
Optional array of strings representing the data required from each git commit
(defaults to all).- authorDate
- authorDateRelative
- authorEmail
- authorName
- body
- commitHash
- commitNotes
- committerDate
- committerDateRelative
- committerEmail
- committerName
- parentHashes
- reflogIdentityEmail
- reflogIdentityName
- reflogSelector
- reflogSubject
- refNames
- sanitizedSubjectLine
- subject
- treeHashFor more information see the
[Git Pretty Formats Documentation](https://git-scm.com/docs/pretty-formats).### `options.skipMerges` boolean
Whether to exclude merge commits from being returned (defaults to true).
## Badges
- [](https://www.npmjs.com/package/giterator)
- [](https://www.npmjs.com/package/giterator)