Cannot create a simple Git alias in MinGW32 on Windows 7

I am trying to create a very simple alias. I want to have the following command:

git log --oneline --graph --all -- decorate 

I find this command a very useful way to view the log file. I want this line to be like git l , because its main way I want to view the log file. This is my attempt to create an alias:

 git config --global alias .l "git log --oneline --graph --all -- decorate" 

This line is executed without errors, but then any attempt to call git l results in the following error message.

 Expansion of alias 'l' failed; 'git' is not a git command 

It was explained that the working environment, windows 7, minGW32 and git version 1.8.3.msysgit.0 may have something to do with this problem, but I'm not sure how to solve it. Thanks to everyone who helps.

+4
source share
1 answer

It should be:

 git config --global alias.l "log --oneline --graph --all --decorate" 

To call something other than the git command, you must prefix it with an exclamation mark:

 git config --global alias.foo "!foo --do-something" 

In your case, it could be:

 git config --global alias.l "!git log --oneline --graph --all --decorate" 
+7
source

Source: https://habr.com/ru/post/1490979/


All Articles