# node-git-current-branch

> Get the current git branch name using Node.js

Latest version **2.0.1** (published 2018-07-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install node-git-current-branch
pnpm add node-git-current-branch
yarn add node-git-current-branch
bun add node-git-current-branch
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2018-07-26 |
| First published | 2018-04-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Maintainers | weigrand |
| Keywords | git, branch, node, js, frontend |

## Links

- npm: https://www.npmjs.com/package/node-git-current-branch
- Repository: https://github.com/WeiGrand/node-git-current-branch
- Homepage: https://github.com/WeiGrand/node-git-current-branch#readme
- Issues: https://github.com/WeiGrand/node-git-current-branch/issues
- npm.io page: https://npm.io/package/node-git-current-branch

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 2.0.1 (latest) — 2018-07-26
- 2.0.0 — 2018-07-26
- 1.0.2 — 2018-04-22
- 1.0.1 — 2018-04-22
- 1.0.0 — 2018-04-21

## README

# node-git-current-branch
Get the current git branch name using Node.js

## Install

```bash
npm install node-git-current-branch --save
```
## Usage

```javascript
const getCurrentBranchName = require('node-git-current-branch');

getCurrentBranchName(); // branch name or false
```

## API

### getCurrentBranchName([ path ]);

Returns branch name or false

## Props

##### path

Type: `string`

Default: `process.cwd()`

Required: `false`

The path which you want to get it's git repository's branch name.

> Actually you don't need to pass anything, just call the function anywhere inside your git repository.

## CHANGE LOG

`v2.0.x` no longer requires you to pass the **root path which you initialized your git repository**, it will automatically find the branch name if it exists (git initialized).

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