Question

I'm trying to grep the word <template> in a git repository.

How do I write my git grep statement for this? (Shell seems to assume < and > as redirection parameters)

(Looks like this is specific to git for windows run from a cmd session. Git Bash works fine)

Was it helpful?

Solution

Using Git Bash, you should be able to simply quote it: git grep "<template>"....

Running Git via Windows' cmd.exe is a little bit different. There, git grep ^<template^> ... should work. This is because cmd.exe uses ^ as its escape character (rather than \, which is used in Bash, ZSH, and just about every other shell out there).

See also this question.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top