npm.io
1.1.0 • Published 5 months ago

find-git-root

Licence
MIT
Version
1.1.0
Deps
0
Size
4 kB
Vulns
0
Weekly
546.0K
Stars
2

find-git-root

Shields Badge

Recursively find the closest .git/ and return repo path, support git worktree.

Installation

npm install find-git-root

Usage

'use strict'

const findGitRoot = require('find-git-root')

// git clone url /home/you/repo
const root = findGitRoot('/home/you/repo/somedir/somefile')
// => /home/you/repo/.git

const root = findGitRoot('/home/you/repo/somedir')
// => /home/you/repo/.git

Keywords