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

前端 未结 22 989
被撕碎了的回忆
被撕碎了的回忆 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:36

    To amend the "git config" answer just a bit:

    git config --global --add alias.root '!pwd -P'
    

    and get the path cleaned up. Very nice.

提交回复
热议问题