On Tue, Jan 28, 2025 at 10:05 PM Raghavendra N <nraghavendra89@xxxxxxxxx> wrote: > I'm trying to understand how the -G option in git diff works. > Specifically I'm trying to test a Regex which excludes a word from the > git diff. "Inverting" a regular expression is technically always possible, but is difficult to get right, and I think you made a slight error in your attempt. See also https://www.vidarholen.net/contents/blog/?p=36 (which has a link to a Haskell program to generate an inverted regex automatically). With `git grep` you can specify perl-style regular expressions, which allow negative lookahead, but `git diff -G` does not support that. See https://stackoverflow.com/questions/39789921/what-flavor-of-regex-does-git-use for details. I think it would be nice to add some of `git grep`'s options to `git diff` here, but I leave that as an exercise. :-) Chris