When I do git diff HEAD^!
(to diff changes in the HEAD
commit), output is piped to LESS
. I need to search the contents of the diff for /*
(start of C-style comment). I haven't been able to get this working. I hit the forward-slash key on my keyboard to begin searching. I've tried:
//*
//\*
/\/\*
None of these work (first /
is to initiate search mode in LESS
).
When you enter /
in less, the following expression is a regex. As such, *
has special meaning there; /*
thus searches for zero-or-more instances of /
.
To prevent any character from having special meaning, you can enter it as a character class:
/[/][*]
...ensures that both of the characters you're searching for are treated literally. This works in other regular-expression contexts (grep, etc) as well.
That said, the above is somewhat more paranoid than necessary. In my tests, the below work as well:
//[*]
//\*