git - 致命 : bad config file line in . 为删除 merge 分支创建别名时的 gitconfig 文件

标签 git

谁能帮我弄清楚 .gitconfig 文件中的这一行有什么问题?

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

命令本身有效,我正在关注这篇文章 ( How can I delete all git branches which have been merged? )

但是当我运行别名“git db”时,它将失败并显示“fatal: bad config file line 22”,它指向我的 .gitconfig 文件中的那一行

最佳答案

扩展 MrTux 的评论:引号 ("") 在 Git 配置文件中具有特殊含义。如果你想在配置值中使用它们,你必须转义它们然后引用整个值,就像这样:

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

关于git - 致命 : bad config file line in . 为删除 merge 分支创建别名时的 gitconfig 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28973478/

相关文章:

Git/SmartGit 无法推送 "big"文件

Windows 上的 Git 1.6.4 beta (msysgit) - Unix 或 DOS 行终止

git - 如何知道 git 浅克隆的深度?

git - 如何在 git-bash 中修复 "bfg: command not found"

git - 如何理解 `git log --all --graph --oneline --decorate` 的图形输出?

git - 巡航控制.NET : how to set username and password for git repository task?

eclipse - 如何让Egit记住密码和用户名?

Git推送到 checkout ?

regex - 如何在 git checkout 命令中使用正则表达式来指定文件子集

git - 如何在 VS Code 中只提交跟踪的文件?