" --grep="" Is it possi...">

How do I set up a parameterized git alias?

I often run

git log -10 --author="<author name>" --grep="<story of interest>"

      

Is it possible to set up a git alias similar to

git by "<author name>" "<story of interest>" -10

      

what will do the same thing?

The documentation does not mention parameters.

+3


source to share


1 answer


You can create an alias as a shell command:

git config alias.agrep '!f() { git log -10 --author="$1" --grep="$2"; }; f'

      



Now call git agrep

with two parameters git agrep Matt test

.

See the GitAlias ​​repo for dozens of useful aliases and examples. Full disclosure: I am the author.

+2


source







All Articles