运行“git status”针对系统中其他位置的存储库 [英] Running "git status" against a repository located elsewhere in the system

查看:96
本文介绍了运行“git status”针对系统中其他位置的存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以这样做:

I know that I can do this:

git --git-dir="Z:/www/proj/web/test/sample-repo-cloned/.git" status

然而,问题在于命令从 proj 文件夹运行,这意味着所有位于 sample-repo-cloned 之前的文件也将是考虑到。

However, the problem is that the command is run from proj folder, which means that all files that are located before sample-repo-cloned will also be taken into account.

有没有办法在 sample-repo-cloned 文件夹的范围内运行此命令?

Is there a way to run this command under the scope of sample-repo-cloned folder?

推荐答案

--work-tree

即:

Ie:

git --work-tree="Z:/www/proj/web/test/sample-repo-cloned/" --git-dir="Z:/www/proj/web/test/sample-repo-cloned/.git"  status

结果应该位于工作树根目录的本地。

The result should be local to the working tree root directory.

这篇关于运行“git status”针对系统中其他位置的存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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