Package detail

current-git-branch

JPeer264279.9kMIT2.0.1

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

is, git, added, HEAD

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

changelog

2.0.1 - January, 15 2025

  • 1723789 Fix: show the current branch when multiple branches are set (ref: #4) (JPeer264)
  • ba79b24 Fix: do not fail when arguments are empty (fixes: #4) (JPeer264)
  • 1da5c82 Fix: prettier ignore changelog.md (JPeer264)

2.0.0 - January, 14 2025

  • 3122f4f Feat: add ESM | modernise the project (JPeer264)

1.1.0 - October, 16 2018

  • 164bdb9 Chore: drop support for Node v4 (#2) (Jan Peer Stöcklmair)
  • 7d6bddc Ability to pass options to git-branch command (#1) (Ryan Stimmler)
  • 5a2b4ea 1.0.1 (JPeer264)
  • fee095b Test: update fixtures (JPeer264)
  • 190593d 1.0.1 (JPeer264)
  • f4aba3c Feat: add test folder (JPeer264)
  • b014237 Feat: remove test folder (JPeer264)

    1.0.1 - December, 18 2017

  • f4aba3c Feat: add test folder (JPeer264)

  • b014237 Feat: remove test folder (JPeer264)
  • 369da22 CI: add Node v8 testing (JPeer264)
  • f930a7e Test: fix tests for CI (JPeer264)
  • cc4f997 Chore: update gitignore (JPeer264)
  • b2a4d80 Test: fix tests (JPeer264)
  • 392accf Style: lint tests (JPeer264)
  • c559b53 Fix: add require support (JPeer264)

    1.0.0 - April, 08 2017

  • 0779d69 :wrench: Chore: move is-ci to devdeps (JPeer264)

  • ef81597 :memo: Docs: add appveyor badge (JPeer264)
  • 6f457f9 :wrench: Chore: remove test.js from the coverage (JPeer264)
  • 8328038 :white_check_mark: Test: wrong parentheses on CI tests (JPeer264)
  • d985459 :white_check_mark: Test: own tests for CIs (JPeer264)
  • 7569b58 :wrench: Chore: add is-ci as CI detach HEADs (JPeer264)
  • 769c1c9 :white_check_mark: Test: update tests for CIs (JPeer264)
  • 172d2fd :wrench: Chore: update npm to latest (JPeer264)
  • 08dd97c :wrench: Chore: add npm/node version to travis for debugging (JPeer264)