In Git, you can pass an alias from another alias

Let's say I have such an alias in my .gitconfig:

alias.showlog = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' 

and now I need a similar alias:

 alias.sl = showlog --abbrev-commit 

When I try to execute the git sl command, it says that it does not know the showlog command.

I know that it is still possible to copy the same command as another alias, but I just want to know if it is possible to refer to another alias in the alias?

+6
source share
1 answer

Not so, but you can make an alias that runs the command through the shell, so we run another git instance that resolves the second alias:

 alias.sl = !git showlog --abbrev-commit 
+12
source

All Articles