Search for a string in Git history

Git is one of the most powerful tools in a developers life, here's how to search for stuff in cli.

$ git log -p -S"string" | grep --color=auto -C 5 "string"

This will search for a string in your repo's history and print out five lines from the found string on wards.

All articles


Comments

No published comments yet.


Add a Comment

Your comment is held for review before it appears publicly.

Your email is never published or shared.

Up to 2,000 characters.

Tick the box, then click Submit right away (Google expires the check after about two minutes).