Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kaelzhang/nodegit-is

The definitive checking library for git
https://github.com/kaelzhang/nodegit-is

git is-git is-git-root

Last synced: 9 days ago
JSON representation

The definitive checking library for git

Awesome Lists containing this project

README

        

[![Build Status](https://travis-ci.org/kaelzhang/nodegit-is.svg?branch=master)](https://travis-ci.org/kaelzhang/nodegit-is)
[![Coverage](https://codecov.io/gh/kaelzhang/nodegit-is/branch/master/graph/badge.svg)](https://codecov.io/gh/kaelzhang/nodegit-is)

# @nodegit/is

The definitive checking library for git

## Install

```sh
$ npm i @nodegit/is
```

## Usage

```js
const is = require('@nodegit/is')

// Test if the current working directory is a git repo
// or inside a git repo
is.git()

// Which is equivalent to
is.git(process.cwd())

// Test if the current working directory is the root of a git repo
is.gitRoot()
```

### git(dir = process.cwd()): boolean

- **dir** `string=process.cwd()` the directory to be tested. If not specified, the current working directory will be used

Returns `boolean` true if `cwd` is the root of a git repo or inside a git repo

### gitRoot(dir = process.cwd()): boolean

- **dir**

Returns `boolean` true if `cwd` is the root of a git repo

## License

[MIT](LICENSE)