Find the root directory of a `git` repository
npm install git-root-dir



Find the root directory of a git repository.
Useful for tools that need to know whether git is managing the things inside.
``sh`
npm install --save git-root-dir
`sh`
/
└── Users
└── luftywiranda
└── foo
├── .git
└── bar
├── baz
└── example.js
`js
// example.js
const gitRootDir = require('git-root-dir');
gitRootDir(__dirname).then(rootDir => {
console.log(rootDir);
//=> '/Users/luftywiranda/foo'
});
`
Returns a Promise for either the repository root path or null if it couldn't be found.
#### cwd
Type: stringprocess.cwd()
Default:
Directory to start from.
* git-dir-up – Find the closest .git` directory
* pkg-dir – Find the root directory of a Node.js project or npm package
MIT © Lufty Wiranda