I would recommend doing this bash script in your PATH instead, and then calling that script instead of your git alias (or if it is in your PATH anyway, just name the file git-bd
).
For example, create the file ~/bin/git-bd
#!/usr/bin/env bash git branch --merged | egrep -v '(^\*|master|dev)' | xargs git branch -d
Make the executable with the command:
chmod +x ~/bin/git-bd
And make sure your .bashrc
, .bash_profile
or .bash_login
has a line:
export PATH="$HOME/bin:$PATH"
And you can just call git-bd
directly or add an alias to your .gitconfig
like this:
bd = "!git-bd"
To add to this answer, the reason you get the wrong configuration error might be caused by backslashes. git -config will read them as is, so you need to avoid them again with a second backslash.
source share