current-git-branch
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/current-git-branch package

1.1.0 • Public • Published

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

/current-git-branch/

    Package Sidebar

    Install

    npm i current-git-branch

    Weekly Downloads

    113,623

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    206 kB

    Total Files

    55

    Last publish

    Collaborators

    • jpeer