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: 10 months 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 (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-24T17:41:14.000Z (over 8 years ago)
- Last Synced: 2024-11-06T05:43:46.079Z (over 1 year 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
[](https://travis-ci.org/JPeer264/node-git-root)
[](https://ci.appveyor.com/project/JPeer264/node-git-root/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)