Running “git status” against a repository located

2019-03-01 23:57发布

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 command 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?

2条回答
成全新的幸福
2楼-- · 2019-03-02 00:23

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

查看更多
做个烂人
3楼-- · 2019-03-02 00:25

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.

查看更多
登录 后发表回答