Joncom
Joncom

Reputation: 2146

Alias doesn't work, but the command it references does?

Why does the alias does not have the same effect as typing the command which the alias "is equal to"? Sorry for such a short question, but it's really all right there in the picture.

enter image description here

Edit: Just in case this helps, here's all my aliases.

enter image description here

Upvotes: 0

Views: 135

Answers (2)

Joachim Isaksson
Joachim Isaksson

Reputation: 180887

Pipes don't work in aliases since the aliases are executed by git, not the shell.

You can do it using ! to escape to the shell and execute git recursively though;

$ git config alias.test '!git ls-files -v | grep ^h'

$ git test
h test.c
h test.py

Upvotes: 2

Vash2593
Vash2593

Reputation: 119

I think, git doesn't run git ls-files -v | grep ^h, but just search for the command ls-files

Try with: !git ls-files -v | grep ^h

Upvotes: 1

Related Questions