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
精彩评论