git grep小于或大于字符(在Windows shell中)

时间:2014-01-20 22:40:50

标签: git cmd escaping windows-shell msysgit

我正试图在git存储库中grep <template>这个词。

如何为此编写git grep声明? (Shell似乎假设&lt;和&gt;作为重定向参数)

(看起来这是git for windowscmd会话开始的.Git Bash工作正常)

1 个答案:

答案 0 :(得分:1)

使用Git Bash,你应该能够简单地引用它:git grep "<template>"...

通过Windows cmd.exe运行Git有点不同。在那里,git grep ^<template^> ...应该有效。这是因为cmd.exe使用^作为其转义字符(而不是\,它用于Bash,ZSH以及几乎所有其他shell)。

另见this question