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: about 1 month ago
JSON representation
The definitive checking library for git
- Host: GitHub
- URL: https://github.com/kaelzhang/nodegit-is
- Owner: kaelzhang
- License: other
- Created: 2019-09-19T03:50:40.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-09-19T06:32:38.000Z (over 6 years ago)
- Last Synced: 2026-04-07T21:38:58.911Z (about 2 months ago)
- Topics: git, is-git, is-git-root
- Language: JavaScript
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/kaelzhang/nodegit-is)
[](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)