How would you implement a git alias that executes external commands, and works from both bash and Powershell?
I currently have a gitPrune alias set up for both bash (in my .bash_profile) and Powershell (in profile.ps1), which cleans up branches that are no longer needed:
# bash
alias gitPrune="git remote prune origin; git branch --merged | grep -vEe '^\*| master$' | sed 's/.*/git branch -dv \0/e'"
# Powershell
function gitPrune { git remote prune origin; git branch --merged | Select-String -NotMatch '^\*| master$' | %{git branch -dv $_.ToString().Trim()} }
This way, I can gitPrune from both git-bash (on Windows) and from Powershell. Now I'd like to move this into my .gitconfig, to keep together with other git-related aliases. However, the same .gitconfig will be used regardless of whether I have a Powershell console or the git-bash terminal open. How do I implement this "dual" command using the git-config "external command" syntax?
[alias]
myPrune = "! ..."