Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jpeer264/node-git-root
A module to find the git root synchronously
https://github.com/jpeer264/node-git-root
git is-git repo repository root tool toplevel
Last synced: about 1 month ago
JSON representation
A module to find the git root synchronously
- Host: GitHub
- URL: https://github.com/jpeer264/node-git-root
- Owner: JPeer264
- License: mit
- Created: 2017-12-24T08:08:38.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-24T17:41:14.000Z (almost 7 years ago)
- Last Synced: 2024-11-06T05:43:46.079Z (about 2 months ago)
- Topics: git, is-git, repo, repository, root, tool, toplevel
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/git-root
- Size: 51.8 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# git-root
[![Build Status](https://travis-ci.org/JPeer264/node-git-root.svg?branch=master)](https://travis-ci.org/JPeer264/node-git-root)
[![Build status](https://ci.appveyor.com/api/projects/status/4rqo2xdyr5wb72g5/branch/master?svg=true)](https://ci.appveyor.com/project/JPeer264/node-git-root/branch/master)
[![Coverage Status](https://coveralls.io/repos/github/JPeer264/node-git-root/badge.svg?branch=master)](https://coveralls.io/github/JPeer264/node-git-root?branch=master)Get synchronously the git root path
## Installation
```sh
$ npm i git-root --save
```
or
```sh
$ yarn add git-root
```## Usage
Returns:
- String: The git root **or** empty string if it is not a git repository```js
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](https://www.jpeer.at)