0.0.1 • Published 4 years ago

simple-git-log v0.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

simple-git-log

With this package you can get basic data from the log of a git repository.

Currently the following details from a commit are retrieved:

  • commit hash
  • abbreviated commit hash
  • author name
  • author email
  • subject

Usage:

This package requires that git is installed and the user executing the script can also execute the git binary which must be located in the path.

const simpleGitLog = require("simple-git-log");

let log = simpleGitLog({
  path: "/path/to/git/repository/", // Can be ommitted, then process.cwd() is used
  range: {
    // Can be ommitted, then the entire history will be returned. If the range option is passed start AND end must contain values
    start: "21465989cc9c83de35ce3c700ad41cc23d9ed77f",
    end: "e09f44e2539ea9be755facbb777f06e7daef8144",
  },
}).then((log) => {
  console.log(log);
  /* Example Output:
  [
    {
      fullHash: 'e2bf01425af589ad5aa982ac9946fc0c7da69a15',
      abbrevHash: 'e2bf014',
      name: 'Lukas Planz',
      email: 'lukas.planz@web.de',
      title: 'chore(init): update package.json'
    },
    {
      fullHash: 'e09f44e2539ea9be755facbb777f06e7daef8144',
      abbrevHash: 'e09f44e',
      name: 'Lukas Planz',
      email: 'lukas.planz@web.de',
      title: 'feat: add git log parser'
    }
  ]
  */
});