Is there a way to get the git root directory in one command?

前端 未结 22 1230
被撕碎了的回忆
被撕碎了的回忆 2020-11-22 09:57

Mercurial has a way of printing the root directory (that contains .hg) via

hg root

Is there something equivalent in git to get the director

22条回答
  •  迷失自我
    2020-11-22 10:58

    Since Git 2.13.0, it supports a new option to show the path of the root project, which works even when being used from inside a submodule:

    git rev-parse --show-superproject-working-tree
    

提交回复
热议问题