JSPM

node-git-current-branch

2.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3132
  • Score
    100M100P100Q121803F
  • License ISC

Get the current git branch name using Node.js

Package Exports

  • node-git-current-branch

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-git-current-branch) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

node-git-current-branch

Get the current git branch name using Node.js

Install

npm install node-git-current-branch --save

Usage

const getCurrentBranchName = require('node-git-current-branch');

getCurrentBranchName(); // branch name or false

API

getCurrentBranchName([ path ]);

Returns branch name or false

Props

path

Type: string

Default: process.cwd()

Required: false

The path which you want to get it's git repository's branch name.

Actually you don't need to pass anything, just call the function anywhere inside your git repository.

CHANGE LOG

v2.0.x no longer requires you to pass the root path which you initialized your git repository, it will automatically find the branch name if it exists (git initialized).