current-git-branch
Version:
A tool to check if files are added in a git repository
35 lines (24 loc) • 1.02 kB
Markdown
# current-git-branch
[](https://travis-ci.org/JPeer264/node-current-git-branch)
[](https://ci.appveyor.com/project/JPeer264/node-current-git-branch)
[](https://coveralls.io/github/JPeer264/node-current-git-branch?branch=master)
Get synchronously the current branch name
## Installation
```sh
$ npm i current-git-branch --save
```
or
```sh
$ yarn add current-git-branch
```
## Usage
Returns:
- Boolean `false`: It is not a git repository
- String: The branch name
```js
const branchName = require('current-git-branch');
branchName(); // false or branch name of process.cwd()
branchName('any/git/repo'); // false or branch name of the directory 'any/git/repo'
```
## LICENSE
MIT © [Jan Peer Stöcklmair](https://www.jpeer.at)