git top

Get the top level directory name

Git alias:

top = rev-parse --show-toplevel

Example:

git top
/home/alice/projects/example