# git-local-info

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

Latest version **1.0.1** (published 2019-01-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install git-local-info
pnpm add git-local-info
yarn add git-local-info
bun add git-local-info
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-01-16 |
| First published | 2019-01-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >= 4.0 |
| Dependencies | 1 |
| Unpacked size | 11.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | ycjcl868 |
| Maintainers | ycjcl868 |
| Keywords | git, gitinfo |

## Links

- npm: https://www.npmjs.com/package/git-local-info
- Repository: https://github.com/ycjcl868/git-local-info
- Issues: https://github.com/ycjcl868/git-local-info/issues
- npm.io page: https://npm.io/package/git-local-info

## Dependencies (1)

- [ini](https://npm.io/package/ini.md) ^1.3.5

## Recent versions

- 1.0.1 (latest) — 2019-01-16
- 1.0.0 — 2019-01-14

## README

# git-local-info

## Badges

[![npm package](https://img.shields.io/npm/v/git-local-info.svg?style=flat-square)](https://www.npmjs.org/package/git-local-info) [![Build Status](https://travis-ci.org/ycjcl868/git-local-info.svg?branch=master)](https://travis-ci.org/ycjcl868/git-local-info) [![dependencies Status](https://david-dm.org/ycjcl868/git-local-info/status.svg)](https://david-dm.org/ycjcl868/git-local-info)

--------------------

## gitInfo

Retrieves repo information without relying on the `git` command.

### Usage

```
// install
$ npm install git-local-info -S
```

```javascript
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);

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


### Screenshot

![image](https://user-images.githubusercontent.com/13595509/51222175-90a44c80-1977-11e9-81f7-e732e86c38de.png)

---
_Source: https://npm.io/package/git-local-info · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
