开发者

Can git tell me what the current managed base path is

开发者 https://www.devze.com 2023-01-11 21:38 出处:网络
Assuming I am somewhere in a repository managed by git, which is based at some path. I.e.: /home/whatever/username/MyRepository/a/b/c

Assuming I am somewhere in a repository managed by git, which is based at some path. I.e.:

/home/whatever/username/MyRepository/a/b/c

where everything under

/home/whatever/username/MyRepository

is under git control.

Is there a git command I can run from some arbitrary location under the managed path which returns the base path (in this case

/home/whatever/username/MyRepository

)? I could reverse s开发者_JAVA百科earch through the directory structure, and wait to find the .git directory, but that seems exceptionally hackish.

Thanks!


This:

git rev-parse --show-toplevel
0

精彩评论

暂无评论...
验证码 换一张
取 消