https://github.com/fabien0102/git2json
Simple tool to get a JSON from your git log.
https://github.com/fabien0102/git2json
cli git log tool
Last synced: 5 months ago
JSON representation
Simple tool to get a JSON from your git log.
- Host: GitHub
- URL: https://github.com/fabien0102/git2json
- Owner: fabien0102
- Created: 2017-02-08T12:44:35.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-04-01T12:42:44.000Z (over 6 years ago)
- Last Synced: 2025-04-10T02:56:13.753Z (6 months ago)
- Topics: cli, git, log, tool
- Language: JavaScript
- Size: 87.9 KB
- Stars: 30
- Watchers: 4
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# git2json
[](https://travis-ci.org/fabien0102/git2json)
[](https://codeclimate.com/github/fabien0102/git2json)
[](https://lima.codeclimate.com/github/fabien0102/git2json)
[](https://lima.codeclimate.com/github/fabien0102/git2json/coverage)
[](https://badge.fury.io/js/%40fabien0102%2Fgit2json)Simple tool to get a JSON from your git log.
## CLI usage
1. Install package globally -> `npm i -g @fabien0102/git2json` or `yarn global add @fabien0102/git2json`
1. Navigate to your local git repository folder
1. Do `git2json > export.json`
1. Voilà!## Lib usage
1. Add dependency -> `npm i -s @fabien0102/git2json` or `yarn add @fabien0102/git2json`
1. Use it!```javascript
const git2json = require('@fabien0102/git2json');git2json
.run()
.then(myGitLogJSON => console.log(myGitLogJSON));
```## Advanced usage
If needed, you have access to `parsers` and `defaultFields` for easy overriding.
Example:
```javascript
const git2json = require('@fabien0102/git2json');
const exportedFields = {
author: git2json.defaultFields['author.name'],
commit: git2json.defaultFields.commit,
shortTree: { value: '%T', parser: a => a.slice(0, 5)}
};git2json
.run({fields: exportedFields})
.then(json => console.log(json));
```You can also specify a path, or paths, for the git repository. Just like the above options, doing so is optional with sane defaults. Multiple paths results in a flattened combined log output.
Example specifying `path`:
```javascript
const git2json = require('@fabien0102/git2json');
const path = '~/src/hack/git2json';git2json
.run({ path })
.then(console.log);
```Example specifying `paths`:
```javascript
const git2json = require('@fabien0102/git2json');
const paths = ['~/etc', '~/src/hack/git2json'];git2json
.run({ paths })
.then(console.log);
```