What is git-raw-commits?
The git-raw-commits npm package is designed to generate raw git commits from your repository's history. It allows developers to programmatically access commit information, which can be useful for generating changelogs, analyzing project history, or automating versioning processes.
What are git-raw-commits's main functionalities?
Generating raw commits
This feature allows you to generate raw commit data between two tags (from 'v1.0.0' to 'v2.0.0' in this example). The output can be piped to any writable stream, such as `process.stdout` for display or a file stream for saving.
const gitRawCommits = require('git-raw-commits');
gitRawCommits({ from: 'v1.0.0', to: 'v2.0.0' }).pipe(process.stdout);
Filtering commits
This feature demonstrates how to filter commits by a specific pattern using the `grep` option. In this example, only commits with 'Fix' in their messages between 'v1.0.0' and the latest commit ('HEAD') are generated.
const gitRawCommits = require('git-raw-commits');
gitRawCommits({ from: 'v1.0.0', to: 'HEAD', grep: 'Fix' }).pipe(process.stdout);
Other packages similar to git-raw-commits
conventional-changelog
Similar to git-raw-commits, conventional-changelog is a tool for generating changelogs based on semantic versioning and commit conventions. While git-raw-commits provides raw commit data, conventional-changelog processes this data to create formatted changelog entries, offering a higher-level abstraction.
gitlog
gitlog is another npm package that allows you to retrieve commit logs from your git repository. Compared to git-raw-commits, gitlog offers a simpler interface for accessing commit information but lacks the fine-grained control over commit selection and formatting.
![Coverage Status](https://coveralls.io/repos/stevemao/git-raw-commits/badge.svg)
Get raw git commits out of your repository using git-log(1)
Install
$ npm install --save git-raw-commits
Usage
var gitRawCommits = require('git-raw-commits');
gitRawCommits(options)
.pipe(...);
API
gitRawCommits([options])
Returns a readable stream. Stream is split to break on each commit.
options
Type: object
Please check the available options at http://git-scm.com/docs/git-log.
NOTE: Single dash arguments are not supported because of https://github.com/sindresorhus/dargs/blob/master/index.js#L5.
NOTE: for <revision range>
we can also use <from>..<to>
pattern, and this module has the following extra options for shortcut of this patter:
from
Type: string
Default: ''
to
Type: string
Default: 'HEAD'
This module also have the following additions:
format
Type: string
Default: '%B'
Please check http://git-scm.com/docs/git-log for format options.
CLI
$ npm install --global git-raw-commits
$ git-raw-commits --help
Get raw git commits out of your repository using git-log(1)
Usage
git-raw-commits [<git-log(1)-options>]
Example
git-raw-commits --from HEAD~2 --to HEAD^
License
MIT © Steve Mao