开发者

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

开发者 https://www.devze.com 2023-04-11 06:49 出处:网络
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 th

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

精彩评论

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

关注公众号