Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to grep search committed code in git? — First published on fullweb.io issue #47

How to grep search committed code in git?

Search working tree for text matching regular expression regexp:

git grep regexp 

Search working tree for lines of text matching regexp A or B:

git grep -e A --or -e B 

Search working tree for lines of text matching regexp A an B:

git grep -e A --and -e B 

Search all revisions between rev1 and rev2 for text matching regular expression regexp:

git grep regexp $(git rev-list rev1..rev2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.