3 回答

TA貢獻2003條經驗 獲得超2個贊
我在文檔中找不到,但是如果您在路徑中創建腳本“ git- <名稱>”,則可以在存儲庫中使用“ git name”來調用它。
看到:
$ cd ~/bin
$ echo "echo I love this log:
>pwd
>git log --graph --summary --decorate --all" > git-logg
$ chmod +x git-logg
$ cd /path/to/your/repo
$ git logg
I love this log:
/path/to/your/repo
* commit 3c94be44e4119228cc681fc7e11e553c4e77ad04 (whatever-branch)
| Author: myself <my@Laptop.(none)>
| Date: Fri Apr 1 16:47:20 2011 +0200
|
| would have been better not to do it at all
|
...
$
因此,您也可以使用這種(不太明顯的)方式來編寫自己喜歡的任何別名。
您甚至可以在該函數的新命令中添加自動補全功能。這里的信息
$ _git_logg ()
{
# you can return anything here for the autocompletion for example all the branches
__gitcomp_nl "$(__gi
添加回答
舉報