Documentation for Simbo's Packages
    Preparing search index...

    Module @simbo/is-git-repository-root - v1.0.1

    Is Git Repository Root

    📦 @simbo/is-git-repository-root

    A lightweight utility for checking whether a directory is the root of a Git repository.

    It simply checks for the presence of a .git folder in the given directory.

    • Detects if a directory is the root of a Git repository

    • Defaults to checking the current working directory

    • Async and Promise-based API

    • Fully typed with TypeScript

    • Zero dependencies (besides other @simbo/* packages)

    ⚠️ Git submodules and worktrees are not considered repository roots.

    Install @simbo/is-git-repository-root from the npm registry:

    npm i [-D] @simbo/is-git-repository-root
    

    For a complete API reference, see the documentation.

    import { isGitRepositoryRoot } from '@simbo/is-git-repository-root';

    if (await isGitRepositoryRoot()) {
    console.log('This is a Git repository root.');
    }

    if (await isGitRepositoryRoot('/path/to/dir')) {
    console.log('That directory is a Git repository root.');
    }

    MIT © Simon Lepel

    Functions

    isGitRepositoryRoot