2

I'm looking for a tool that lets me perform a search through a complete Git repository (all branches). Ideally that tool would take some search pattern and would return a list of commit objects where that pattern appears (either in the file diffs or in the commit message [ I'm more interested in searching for the pattern in the commit messages than in the files]).

4

For searching commit messages, use git log --grep <regex> [branches].

For searching commit diffs, use git log -G <regex> [branches].

To specify all existing local branches, use --all in place of the branch name.

If you want only a list of hashes, use --format=%H.

1
  • Ha! Exactly what I needed (and --all really gives me all branches, including the remote tracking ones, which is indeed what I need). Thanks! – Stefan Dec 3 '15 at 12:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.