JSPM

current-git-branch

2.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 63763
  • Score
    100M100P100Q159402F
  • License MIT

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

Package Exports

  • current-git-branch

Readme

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