current-git-branch

A tool to check if files are added in a git repository


Keywords
is, git, added, HEAD, repo, is-git, exists, branch, commit, nodejs
License
MIT
Install
npm install current-git-branch@1.0.0

Documentation

current-git-branch

Build Status Build status Coverage Status

Get synchronously the current branch name

Installation

$ npm i current-git-branch --save

or

$ yarn add current-git-branch

Usage

Returns:

  • Boolean false: It is not a git repository
  • String: The branch name
const branchName = require('current-git-branch');

branchName(); // false or branch name of process.cwd()
branchName({ altPath: 'any/git/repo' }); // false or branch name of the directory 'any/git/repo'
branchName({ altPath: 'any/git/repo', branchOptions: [ "--no-color" ] }); // alternatively, you may pass git-branch command options, either as a string or an array

LICENSE

MIT © Jan Peer Stöcklmair