Git alias that takes an argument in PowerShell

Viewed 185

I want to create a git alias through command line that can take an argument. There are a lot of examples out there that use an anonymous bash function, but I can't find any that works in PowerShell.

What I have tried is something like this:

git config --global alias.test '!& { param($msg) Write-Host $msg }'

Running git test "Hello" results in:

> git test "Hello"
& { param($msg) Write-Host $msg }: -c: line 0: syntax error near unexpected token `&'
& { param($msg) Write-Host $msg }: -c: line 0: `& { param($msg) Write-Host $msg } "$@"'

How can I do this?

0 Answers
Related