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
Get the path to current repository’s root directory from any inner folder.
$ pwd
/home/wilson/workspace/husin.dev/public
$ git rev-parse --show-toplevel
/home/wilson/workspace/husin.dev
© 2023-2025 Wilson Husin
This site was last updated
:wq