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-05-17T20:42:58-0700.

:wq