Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/linusu/node-git-log
Read Git commit history from Node.js
https://github.com/linusu/node-git-log
Last synced: 4 days ago
JSON representation
Read Git commit history from Node.js
- Host: GitHub
- URL: https://github.com/linusu/node-git-log
- Owner: LinusU
- Created: 2019-12-10T17:53:23.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-05-22T10:40:42.000Z (over 1 year ago)
- Last Synced: 2024-11-02T12:11:54.697Z (11 days ago)
- Language: JavaScript
- Size: 16.6 KB
- Stars: 7
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Node.js Git Log
Read Git commit history from Node.js.
## Installation
```sh
npm install --save git-log
```## Usage
```js
import gitLog from 'git-log'const commits = await gitLog()
console.log(commits[0].title)
//=> Upgrade to Node.js 10.xconsole.log(commits[0].date)
//=> 2019-10-07T20:47:10.000Zconsole.log(commits[0].body)
//=> This patch change the Node.js verison to...console.log(commits[0].hash)
//=> e79b76217e03ba5b4e87182d07f855d9ff3e6d95
```## API
### `gitLog([options])`
- `options` (`object`, optional)
- `merges` (`boolean`, optional) - Wether or not to include commits with more than one parent.
- `range` (`string`, optional) - Include only commits in the specified revision range. When no `range` is specified, it defaults to `'HEAD'` (i.e. the whole history leading to the current commit).
- `repo` (`string`, optional) - Path to the repository to read the log from. When no `repo` is specified, the current working dirtectory will be used.
- `path` (`string | string[]`, optional) - Path to a file or directory to limit results to specific changes. When no `path` is specified, the entire history of the project is returned.
- returns `Promise` - List of commits
- `subject` (`string`) - Subject of the commit
- `body` (`string`) - Body of the commit
- `hash` (`string`) - Hash of the commit
- `date` (`Date`) - Committer date of the commit