开发者

Running "git status" against a repository located elsewhere in the system

I know that I can do this:

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

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

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


You should be able to specify the working tree as well as the git directory:

--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.


What's wrong with (cd Z:/www/proj/web/test/sample-repo-cloned ; git status) ??

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜