ewok ewok - 6 months ago 37
Git Question

git: get path of current directory, relative to root of repo

I've seen this question, which tells how to get the path of a particular file relative to the root of the git repo. But I now want to get the path of the current directory, not a specific file. If I use

git ls-tree --full-name --name-only HEAD .

I get the list of all the files in the directory.

Is this possible?


How about:

$ git rev-parse --show-prefix

From man git-rev-parse:

           When the command is invoked from a subdirectory, show
           the path of the current directory relative to the top-level