0

I am trying to set this simple alias:

alias git plog = git log --pretty=format:'%C(yellow)%h%Cred%d%Creset - %C(cyan)%an %Creset: %s %Cgreen(%cr)'

In my .zshrc file. When I reload I get this:

no matches found: git log --pretty=format:%C(yellow)%h%Cred%d%Creset

If I put this in my .gitconfig

   [alias]
     ci = commit
     plog = log --pretty=format:'%C(yellow)%h%Cred%d%Creset - %C(cyan)%an %Creset: %s %Cgreen(%cr)'

Zsh shell gives me this each time:

$git:(embedded_gifs) git plog
zsh: correct 'plog' to 'log' [nyae]? n

Any ideas to fix this ?

4

2 回答 2

5

Take the latter option of defining the alias in the .gitconfig file and either teach the auto-complete about the plog command or turn of auto-correction. Here is a brief blog post explaining how to achieve this.

于 2013-02-25T10:51:18.560 回答
1

The shell interprets 'git plog' by passing the 'plog' as the first parameter to the Git command, which it does not understand. If you make the alias one word, then it will work.

alias git-plog=...
于 2013-02-25T10:55:09.453 回答