README
Git Diff
Get commits and commit deltas from remote GitHub repos.
Usage
List recent commits:
gitdiff
.getCommits('my_username', 'my_repo')
.then(commits => {});
Or list commits before/after a given ISO 8601 string:
const before = (new Date()).toISOString();
const after = (new Date(1994, 6, 21)).toISOString();
gitdiff
.getCommits('my_username', 'my_repo', { before, after })
.then(commits => {});
Commit objects have the following properties: sha, url and author. Note that, as of this writing, GitHub returns a maximum of 30 commits per request.
Installation
- Download:
npm install @shcallaway/git-diff --save
- Create a personal access token on GitHub.
- Require:
const GitDiff = require('git-diff')
- Instantiate:
const gitdiff = new GitDiff(process.env.TOKEN)
Contributing
There is a pre-commit hook that runs the tests. In order for the tests to pass, you must export your GitHub access token as TOKEN
.