git-root

v1.0.0
A tool to get the git root path
is git root path HEAD repo repository is-git exists and 1 more...

git-root

Build Status Build status Coverage Status

Get synchronously the git root path

Installation

$ npm i git-root --save

or

$ yarn add git-root

Usage

Returns:

  • String: The git root or empty string if it is not a git repository
const gitRoot = require('git-root');

gitRoot(); // '' or git root of process.cwd()
gitRoot('any/git/repo'); // '' or git root of the directory 'any/git/repo'

LICENSE

MIT © Jan Peer Stöcklmair

npm i git-root

Metadata

  • MIT
  • Whatever
  • Jan Peer Stöcklmair
  • released 12/24/2017

Downloads

Maintainers