Finding Git repository top-level

Get the path to current repository’s root directory from any inner folder.


December 1, 2023
$ pwd
/home/wilson/workspace/husin.dev/public

$ git rev-parse --show-toplevel
/home/wilson/workspace/husin.dev

Thanks for reading. More like this?

#til #git

© 2023-2025 Wilson Husin

This site was last updated 2025-09-16T22:01:08-0700.

:wq