index.js
function firstCommit(dir, cb) {
  if (typeof dir === 'function') {
    return firstCommit(process.cwd(), dir);
  }
  if (typeof cb !== 'function') {
    throw new TypeError('expected callback to be a function');
  }

  lazy.git(dir).log(function(err, history) {
    if (err) return cb(err);

    history.sort(function(a, b) {
      return b.date.localeCompare(a.date);
    });

    cb(null, history[history.length - 1]);
  });
}
function firstCommit(dir, cb) {
  if (typeof dir === 'function') {
    return firstCommit(process.cwd(), dir);
  }
  if (typeof cb !== 'function') {
    throw new TypeError('expected callback to be a function');
  }

  lazy.git(dir).log(function(err, history) {
    if (err) return cb(err);

    history.sort(function(a, b) {
      return b.date.localeCompare(a.date);
    });

    cb(null, history[history.length - 1]);
  });
}
function firstCommit ( dir , cb ) { if ( typeof dir === 'function' ) { return firstCommit ( process . cwd ( ) , dir ) ; } if ( typeof cb !== 'function' ) { throw new TypeError ( 'expected callback to be a function' ) ; } lazy . git ( dir ) . log ( function ( err , history ) { if ( err ) return cb ( err ) ; history . sort ( function ( a , b ) { return b . date . localeCompare ( a . date ) ; } ) ; cb ( null , history [ history . length - 1 ] ) ; } ) ; }
Asynchronously get the first commit from a git repository.

```js
firstCommit('foo/.git', function(err, commit) {
if (err) return console.log(err);
// do stuff with commit
});
```
@param {String} `cwd` current working directory
@param {Function} `callback`
@return {Object}
@api public
Asynchronously get the first commit from a git repository .