문제

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
도움이 되었습니까?

해결책

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'"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top