current-git-branch
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

current-git-branch

Build Status Coverage Status

Get synchronously the current branch name

Installation

$ npm i current-git-branch --save

Usage

Returns:

  • Boolean false: It is not a git repository
  • String: The branch name
import branchName from "current-git-branch";

branchName(); // false or branch name of process.cwd()
branchName({ cwd: "any/git/repo" }); // false or branch name of the directory 'any/git/repo'
branchName({ cwd: "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

Package Sidebar

Install

npm i current-git-branch

Weekly Downloads

59,253

Version

2.0.1

License

MIT

Unpacked Size

69.3 kB

Total Files

88

Last publish

Collaborators

  • jpeer