DEV Community

Discussion on: How to Get the Git Directory

Collapse
 
bezhermoso profile image
Bez Hermoso

git rev-parse --show-toplevel gets you the repo root dir directly.

Collapse
 
burdettelamar profile image
Burdette Lamar

Thanks, Bez. When I looked into this a while back, I found --git-dir, but not --show-toplevel. I'll revise the OP.

Collapse
 
bgadrian profile image
Adrian B.G.

A classic example of developers writing complex solutions for simple problems.