last-commit-log
read git last commit log
Last updated 6 years ago by zyhack .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install last-commit-log 
SYNC missed versions from official npm registry.

last-commit-log


NPM version build status Test coverage node version npm download

Node.js module to get the last git commit information - mostly to be used by CI/CD and building phase.

Who are using

For more

Usage

const LCL = require('last-commit-log');
const lcl = new LCL(); // or `new LCL(dir)` dir is process.cwd() by default

Asychronous use, using a Promise:

lcl
  .getLastCommit()
  .then(commit => console.log(commit));

Synchronous use:

const commit = lcl.getLastCommitSync();

full examples

commit information is an object like this:

{
  "gitTag": "2.0.0",
  "gitBranch": "master",
  "gitRemote": "git@github.com:group/repo.git", // .git http or ssh
  "gitUrl": "http://github.com/group/repo",     // url only
  "shortHash": "42dc921",
  "hash": "42dc921d25a3e7e1607302d2acfdc3fd991c0c01",
  "subject": "chore: add lock",
  "sanitizedSubject": "chore-add-lock",
  "body": "",
  "committer": {
    "date": "1515240839",
    "relativeDate": "2 hours ago",
    "name": "Committer Fred",
    "email": "fred@fred.com"
  },
  "author": {
    "date": "1515240839",
    "relativeDate": "2 hours ago",
    "name": "Author Baz",
    "email": "baz@baz.com"
  }
}

Get map of line changed or added from git diff:

const data = lcl.diff({
  currentBranch: 'gh-pages',
});

/**
{
  '/diff.js': [
    [
      1,
      46
    ]
  ],
  '/index.js': [
    [
      124,
      125
    ]
  ],
  '/package.json': [],
  '/test/diff.test.js': [
    [
      1,
      14
    ]
  ]
}
 */
console.log(data);

Related Projects

Contributors


zhangyuheng


xudafeng


titanism


atidyshirt


stared


yihuineng


antife-yinyue

This project follows the git-contributor spec, auto updated at Sun May 21 2023 11:57:56 GMT+0800.

License

The MIT License (MIT)

Current Tags

  • 3.4.0                                ...           latest (3 months ago)

28 Versions

  • 3.4.0                                ...           3 months ago
  • 3.3.0                                ...           2 years ago
  • 3.2.0                                ...           2 years ago
  • 3.1.2                                ...           3 years ago
  • 3.1.1                                ...           4 years ago
  • 3.1.0                                ...           4 years ago
  • 3.0.4                                ...           5 years ago
  • 3.0.3                                ...           5 years ago
  • 3.0.2                                ...           5 years ago
  • 3.0.1                                ...           5 years ago
  • 3.0.0                                ...           5 years ago
  • 2.1.0                                ...           6 years ago
  • 2.0.0                                ...           6 years ago
  • 1.0.13                                ...           6 years ago
  • 1.0.12                                ...           6 years ago
  • 1.0.11                                ...           6 years ago
  • 1.0.10                                ...           6 years ago
  • 1.0.9                                ...           6 years ago
  • 1.0.8                                ...           6 years ago
  • 1.0.7                                ...           6 years ago
  • 1.0.6                                ...           6 years ago
  • 1.0.5                                ...           6 years ago
  • 1.0.4-0                                ...           7 years ago
  • 1.0.4                                ...           7 years ago
  • 1.0.3                                ...           7 years ago
  • 1.0.2                                ...           7 years ago
  • 1.0.1                                ...           7 years ago
  • 1.0.0                                ...           7 years ago
Maintainers (2)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dependents (0)
None

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