wojo wojo - 1 year ago 84
Git Question

Is there a way to get the git root directory in one command?

Mercurial has a way of printing the root directory (that contains .hg) via

hg root

Is there something equivalent in git to get the directory that contains the .git directory?

Answer Source


git rev-parse --show-toplevel
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download