有没有办法在一个命令中获取git根目录? [英] Is there a way to get the git root directory in one command?

查看:424
本文介绍了有没有办法在一个命令中获取git根目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Mercurial可以通过

  hg root 
打印根目录(包含.hg) / code>

在git中是否有相当于获取包含.git目录的目录?


<解决方案

是的:

  git rev-parse --show-顶层


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

hg root

Is there something equivalent in git to get the directory that contains the .git directory?

解决方案

Yes:

git rev-parse --show-toplevel

这篇关于有没有办法在一个命令中获取git根目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆