2013-06-03 32 views
0

爲什麼別名與輸入別名「等於」的命令沒有相同的效果?對不起,這樣一個簡短的問題,但它確實是在那裏的圖片。別名不起作用,但它引用的命令的作用是?

enter image description here

編輯:萬一這會有所幫助,這是我所有的別名。

enter image description here

+2

別名僅git的默認,所以管道可能是行不通的;嘗試使用shell別名(可以直接在bash中使用,也可以在git別名中使用「!」符號,請參閱http://iask.sina.com.cn/docs/git-config at alias。*')以轉義到bash環境第一 –

回答

2

管道不別名,因爲別名工作由git執行,而不是shell。

你可以使用!來轉義到shell並遞歸地執行git;

$ git config alias.test '!git ls-files -v | grep ^h' 

$ git test 
h test.c 
h test.py 
1

我認爲,Git並不運行git ls-files -v | grep ^h,只是搜索命令ls-文件

與嘗試:!git ls-files -v | grep ^h