Skip to content

🗝get current sha, branch name, repository, commit info from a git repo without relying on the git command.

Notifications You must be signed in to change notification settings

ycjcl868/git-local-info

Repository files navigation

git-local-info

Badges

npm package Build Status dependencies Status


gitInfo

Retrieves repo information without relying on the git command.

Usage

git-local-info

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

About

🗝get current sha, branch name, repository, commit info from a git repo without relying on the git command.

Resources

Stars

Watchers

Forks

Packages

No packages published