简体   繁体   中英

fatal: bad config file line in .gitconfig file when making an alias for deleting merged branches

Can anyone help me figure out what is wrong with this line in the .gitconfig file?

[alias]
db = !git branch --merged | grep -v "\*" | xargs -n 1 git branch -d

The command by itself works, I was following along this post ( How can I delete all git branches which have been merged? )

But when I run the alias 'git db' it will fail with 'fatal: bad config file line 22' which points to that line in my .gitconfig file

To expand on the comment by MrTux: quotes ( "" ) have special meaning in a Git config file. If you want to use them in a config value, you have to escape them and then quote the entire value, like this:

db = "!git branch --merged | grep -v \"*\" | xargs -n 1 git branch -d"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM