2015-10-26 22 views
1

我在運行Windows上的Cmder時嘗試在父目錄中的所有repos上運行git logfind -exec參數在沒有前導空格的情況下無法運行

UPDATE
我的殼是gitbash版本1.9.4.msysgit.0

當我運行:
find . -name ".git" -type d -maxdepth 2 -exec echo git --git-dir={} log ;

git --git-dir= log 
git --git-dir= log 
git --git-dir= log 

高管似乎並沒有找到找到比賽,但是當我運行命令在{}之前有一個前導空格,匹配被饋送到exec語句,但是git的語法不正確。

find . -name ".git" -type d -maxdepth 2 -exec echo git --git-dir= {} log ;

git --git-dir= ./repo1/.git log 
git --git-dir= ./repo2/.git log 
git --git-dir= ./repo3/.git log 

知道爲什麼-exec不會沒有前導空格處理論據?

+0

你在Cmder中運行哪個shell?我猜git bash,但是你沒有指定......(Cmder很可能是這個問題的附帶...) –

回答

0

仍然不確定問題的根源是什麼,但下面的語法按預期工作。

find . -name ".git" -type d -maxdepth 2 -exec echo git --git-dir="{}" log ;

括在雙引號{}提供我一直在尋找修復。

+0

它很好奇,因爲'find'命令沒有看到雙引號;它們被shell刪除。 –

相關問題