{"id":17419981,"url":"https://github.com/bendrucker/git-log-parser","last_synced_at":"2025-03-17T15:12:55.440Z","repository":{"id":23549191,"uuid":"26916384","full_name":"bendrucker/git-log-parser","owner":"bendrucker","description":"Stream commit objects from git log","archived":false,"fork":false,"pushed_at":"2024-07-16T07:25:41.000Z","size":21,"stargazers_count":24,"open_issues_count":3,"forks_count":11,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-14T22:03:47.491Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bendrucker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-11-20T14:39:01.000Z","updated_at":"2024-07-01T15:13:14.000Z","dependencies_parsed_at":"2025-01-01T15:06:37.542Z","dependency_job_id":"0e00c169-873c-45c5-badb-af9bfc37a74f","html_url":"https://github.com/bendrucker/git-log-parser","commit_stats":{"total_commits":27,"total_committers":2,"mean_commits":13.5,"dds":0.07407407407407407,"last_synced_commit":"658efedb70a23bd1e351a62f90f0a1fa5269260a"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bendrucker%2Fgit-log-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bendrucker%2Fgit-log-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bendrucker%2Fgit-log-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bendrucker%2Fgit-log-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bendrucker","download_url":"https://codeload.github.com/bendrucker/git-log-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244056425,"owners_count":20390719,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-17T02:38:13.261Z","updated_at":"2025-03-17T15:12:55.419Z","avatar_url":"https://github.com/bendrucker.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"git-log-parser [![Build Status](https://travis-ci.org/bendrucker/git-log-parser.svg?branch=master)](https://travis-ci.org/bendrucker/git-log-parser)\n==============\n\nRun `git log` and return a stream of commit objects.\n\n## Setup\n\n```bash\n$ npm install git-log-parser\n```\n\n## API\n\n#### `log.parse(config, options)` -\u003e `Stream(commits)`\n\nAccepts a `config` object mapping to the [options accepted by `git log`](http://git-scm.com/docs/git-log). `config` will be automatically converted to command line options and flags by [argv-formatter](https://github.com/bendrucker/argv-formatter). Returns a stream of commit objects. \n\n`options` is passed directly to [`child_process.spawn`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options).\n\nA commit is structured as follows:\n\n```js\n{\n  commit: {\n    'long': '4bba6092ecb2571301ca0daa2c55336ea2c74ea2',\n    'short': '4bba609'\n  },\n  tree: {\n    'long': 'b4ef3379e639f8c0034831deae8f6ce63dd41566',\n    'short': 'b4ef337'\n  },\n  author: {\n    'name': 'Ben Drucker',\n    'email': 'bvdrucker@gmail.com',\n    'date': new Date('2014-11-20T14:39:01.000Z')\n  },\n  committer: {\n    'name': 'Ben Drucker',\n    'email': 'bvdrucker@gmail.com',\n    'date': new Date('2014-11-20T14:39:01.000Z')\n  },\n  subject: 'Initial commit',\n  body: 'The commit body'\n}\n```\n\n`author.date` and `commiter.date` are `Date` objects while all other values are strings.\n\nIf you just want an array of commits, use [stream-to-array](https://www.npmjs.com/package/stream-to-array) to wrap the returned stream.\n\n#### `log.fields` -\u003e `Object`\n\nCommit objects contain the most frequently used commit information. However, the [field mappings](https://github.com/bendrucker/git-log-parser/blob/master/src/fields.js) used to format and then parse log output can be amended before calling the parser. Consult the [full range of formatting placeholders](http://opensource.apple.com/source/Git/Git-19/src/git-htmldocs/pretty-formats.txt) and add the placeholder to the object tree if you wish to add extra fields.\n\n## Example\n\nGet all commits from earlier than an hour ago and stream them to `stdout` as pretty-printed JSON\n\n```js\nvar log      = require('git-log-parser');\nvar through2 = require('through2');\n\nlog.parse({\n  before: new Date(Date.now() - 60 * 60 * 1000)\n})\n.pipe(through2.obj(function (chunk, enc, callback) {\n  callback(null, JSON.stringify(chunk, undefined, 2));\n}))\n.pipe(process.stdout);\n```\n\nNote that `before` is stringified and passed directly as an argument to `git log`. No special handling is required for any standard `git log` option. You can filter by committer, time, or any other field supported by [`git log`](http://git-scm.com/docs/git-log).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbendrucker%2Fgit-log-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbendrucker%2Fgit-log-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbendrucker%2Fgit-log-parser/lists"}