Package detail

git-local-info

ycjcl868103.2kMIT1.0.1

Retrieve current sha, branch name, repository from a git repo.

git, gitinfo

readme

git-local-info

Badges

npm package Build Status dependencies Status


gitInfo

Retrieves repo information without relying on the git command.

Usage

// install
$ npm install git-local-info -S
import GitInfo from 'git-local-info';


const gitInfo = new GitInfo();

const result = gitInfo.getGitInfo;

// result is:
{
  /** The current branch */
  branch: string;
  /** The current repository url */
  repository: string;
  /** SHA of the current commit */
  sha: string;
  /** The committer of the current SHA */
  commit: ICommit;
  /** The commit message for the current SHA */
  rootDir: string;
}

Params

new GitInfo(params);

// params
{
  // default process.cwd()
  gitPath: process.cwd(),
  // default .git
  GIT_DIR: '.git',
}

Screenshot

image

changelog

1.0.1 / 2019-01-16

  • :tada: init

1.0.0 / 2019-01-15

  • :memo: Readme docs
  • fix: docs
  • init: git info