可能重复:
Is there a way to get to the git root directory in one command?
如何检查我正在使用的git存储库?
我可以看到'git init‘的结果。
git init返回“Reinitialized existing Git repository in c:/Users/k-9/.git/”
但我觉得这不是个恰当的命令。
发布于 2011-10-07 13:12:36
如果您的工作目录是git存储库,git rev-parse --show-toplevel将显示存储库的顶层目录。
$ git rev-parse --show-toplevel
fatal: Not a git repository (or any of the parent directories): .git
$ cd gitrepo
$ git rev-parse --show-toplevel
/home/jamessan/gitrepohttps://stackoverflow.com/questions/7687713
复制相似问题