2017-06-14 19 views
3

我經常跑如何配置參數化的git別名?

git log -10 --author="<author name>" --grep="<story of interest>" 

是否有可能配置類似

git by "<author name>" "<story of interest>" -10 

,將完成同樣的事情git的別名?

The documentation沒有提及參數。

+2

你可以做一個快速的bash腳本。 – alex

+0

這顛覆了這個問題。 – Matt

回答

2

您可以創建別名作爲一個shell命令:

git config alias.agrep '!f() { git log -10 --author="$1" --grep="$2"; }; f' 

現在叫git agrep有兩個參數:git agrep Matt test

請參閱GitAlias repo瞭解幾十個有用的別名和示例。充分披露:我是貢獻者。

+0

完美,謝謝! – Matt