# git-repo-info

> Retrieve current sha and branch name from a git repo.

Latest version **2.1.1** (published 2019-10-18) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.1 |
| Published | 2019-10-18 |
| First published | 2014-09-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 4.0 |
| Dependencies | 0 |
| Unpacked size | 14.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 114 |
| Author | Robert Jackson |
| Maintainers | hjdivad, rwjblue |
| Keywords | git |

## Links

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

## Recent versions

- 2.1.1 (latest) — 2019-10-18
- 2.1.0 — 2018-12-13
- 2.0.0 — 2018-03-30
- 1.4.1 — 2017-02-10
- 1.4.0 — 2016-12-21
- 1.3.1 — 2016-10-25
- 1.3.0 — 2016-10-17
- 1.2.0 — 2016-09-28
- 1.1.4 — 2016-05-25
- 1.1.3 — 2016-05-25
- 1.1.2 — 2015-06-19
- 1.1.1 — 2015-04-15
- 1.1.0 — 2015-04-15
- 1.0.4 — 2015-02-03
- 1.0.3 — 2015-01-26
- … 3 more at https://npm.io/package/git-repo-info/versions

## README

## git-repo-info

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

### Usage

```javascript
var getRepoInfo = require('git-repo-info');

var info = getRepoInfo();

info.branch               // current branch
info.sha                  // current sha
info.abbreviatedSha       // first 10 chars of the current sha
info.tag                  // tag for the current sha (or `null` if no tag exists)
info.lastTag              // tag for the closest tagged ancestor
                          //   (or `null` if no ancestor is tagged)
info.commitsSinceLastTag  // number of commits since the closest tagged ancestor
                          //   (`0` if this commit is tagged, or `Infinity` if no ancestor is tagged)
info.committer            // committer for the current sha
info.committerDate        // commit date for the current sha
info.author               // author for the current sha
info.authorDate           // authored date for the current sha
info.commitMessage        // commit message for the current sha
info.root                 // root directory for the Git repo or submodule
                          //   (if in a worktree, this is the directory containing the original copy)
info.commonGitDir         // directory containing Git metadata for this repo or submodule
                          //   (if in a worktree, this is the primary Git directory for the repo)
info.worktreeGitDir       // if in a worktree, the directory containing Git metadata specific to
                          //   this worktree; otherwise, this is the same as `commonGitDir`.
```

When called without any arguments, `git-repo-info` will automatically lookup upwards
into parent directories to find the first match with a `.git` folder.

If passed an argument, it will be assumed to be the path to the repo's `.git` folder
to inspect.

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