Issue:
I have manually added a simple alias in ~/.gitconfig (git version 2.38.1.windows.1), and it looks like this:
[alias]
lg = !git log --oneline --graph -$1 #
I use it as follows (expecting to get the equivalent result of typing git log --one-line --graph -5
):
$ git lg 5
But it does not work, and I do not understand what am I missing as this same command works for me in other computer, the following error raises:
$ expansion of alias 'lg' failed; 'git' is not a git command
Double check:
The value of $HOME
in my git bash is /c/Users/myself
(as expected), therefore, if I execute the command git config --global -e
it opens the file I modified with my alias. Also, after executing the command git config --list --show-origin
I can see my alias as well:
file:C:/Users/myself/.gitconfig alias.lg=!git log --oneline --graph -$1
Failed attempts (from other answers):
I have also tried adding the alias as a bash function:
[alias]
lg = "!f() { git log --oneline --graph -$1; }; f"
But the issue remains, same if I remove the alias from the config file and try to add it from console:
$ git config alias.lg 'git log --oneline --graph -$1'
Also, there is no effect when removing symbols like !
or #
.
This might be a dumb question but I do not know what else to try, I am kind of stuck here...