如何获取当前目录相对于git存储库根目录的路径?

ewo*_*wok 8 git bash

我已经看过这个问题,它讲述了如何获取特定文件相对于git repo根目录的路径.但我现在想要获取当前目录的路径,而不是特定文件.如果我使用

git ls-tree --full-name --name-only HEAD .
Run Code Online (Sandbox Code Playgroud)

我得到目录中所有文件的列表.

这可能吗?

Ark*_*zyk 23

怎么样:

$ git rev-parse --show-prefix
Run Code Online (Sandbox Code Playgroud)

来自man git-rev-parse:

--show-prefix
           When the command is invoked from a subdirectory, show
           the path of the current directory relative to the top-level
           directory.
Run Code Online (Sandbox Code Playgroud)