git.find_git_dir

git

find_git_dir(start_path) -> git_dir, worktree

Discover the .git directory by walking up from a starting path

Walks the directory tree upward from start_path (defaults to cwd) looking for a .git directory or gitdir file (worktrees/submodules). Returns the resolved git directory path and the worktree root, or nil if not inside a git repository.