HF RL Explorer

Task: Get Path to Root .git/ Directory Including from a Worktree

Task: Get Path to Root .git/ Directory Including from a Worktree: a task in Terminal-Lego-15k (Harbor dataset). Write a shell script that retrieves the path to the "root" .git/ directory of a Git repository, even when executed from within a Git worktree. When inside a worktree, the script should…

The task

Write a shell script that retrieves the path to the "root" `.git/` directory of a Git repository, even when executed from within a Git worktree. When inside a worktree, the script should return the `.git/` directory of the **source (main) repository**, not the worktree-specific `.git` path.

Part of PrimeIntellect/Terminal-Lego-15k.