get-first-commit
Returns a git repository's first commit as a JavaScript object.
Last updated 11 years ago by jonschlinkert .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install get-first-commit 
SYNC missed versions from official npm registry.

get-first-commit NPM version Build Status

Returns a git repository's first commit as a JavaScript object.

Install

Install with npm

$ npm i get-first-commit --save

Usage

var getFirstCommit = require('get-first-commit');

getFirstCommit(function(err, commit) {
  if (err) return console.log(err);
  console.log(commit);
});

Results in

{ commit: 'b371794fbdbdd68498e8c9f3bf766b095ad2fb30',
  author: 'jonschlinkert <jon.schlinkert@sellside.com>',
  date: 'Sun Nov 22 07:44:07 2015 -0500',
  message: 'first commit' }

API

firstCommit

Asynchronously get the first commit from a git repository.

Params

  • cwd {String}: current working directory
  • callback {Function}
  • returns {Object}

Example

firstCommit('foo/.git', function(err, commit) {
  if (err) return console.log(err);
  // do stuff with commit
});

.sync

Synchronously get the first commit from a git repository.

Params

  • cwd {String}: current working directory
  • returns {Object}

Example

var commit = firstCommit.sync('foo/.git');

Related projects

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Author

Jon Schlinkert

License

Copyright © 2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on November 22, 2015.

Current Tags

  • 0.2.0                                ...           latest (11 years ago)

2 Versions

  • 0.2.0                                ...           11 years ago
  • 0.1.0                                ...           11 years ago
Maintainers (1)
Downloads
Total 9
Today 0
This Week 0
This Month 4
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (1)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE