GitConfig: bad config for shell command

☆樱花仙子☆ 提交于 2020-01-24 09:23:54

问题


I'm trying to set up an alias, as I have many.

For some reason, this one does not work. Any idea?

[alias]
t = "!git log --decorate --oneline | egrep '^[0-9a-f]+ \(tag: ' | sed -r 's/^.+tag: ([^ ]+)[,\)].+$/\1/g'"

Command works fine by itself:

$ git log --decorate --oneline | egrep '^[0-9a-f]+ \(tag: ' | sed -r 's/^.+tag: ([^ ]+)[,\)].+$/\1/g'
1.0.0
0.9.0
...
$ git t
fatal: bad config file line 28 in /Users/alanschneider/.gitconfig

回答1:


Backslash ("\") characters are read by git itself in your config. Just escape them again with a second backslash and it will work:

t = "!git log --decorate --oneline | egrep '^[0-9a-f]+ \\(tag: ' | sed -r 's/^.+tag: ([^ ]+)[,\\)].+$/\\1/g'"


来源:https://stackoverflow.com/questions/13582872/gitconfig-bad-config-for-shell-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!