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
添加回答
举报