Please enable JS

Search all branches of a Git repo

Search across all branches in your Git repository for text.
April 19/Brian Young/Software

Recently I couldn't find work I knew I wrote earlier. My only guess was that it was in a branch that wasn't obvious to me. After some googling, I came across this SO post that demonstated searching all branches of a repo.

Example

  1. git grep "Your string or Regexp" $(git rev-list --all)

Additional tip

The results of the above search will provide commit hashes and file names. Use the hash to locate the branch that contains the change be running:

  1. git branch --contains XXXXXXXXXXXXXXXXXX
Git


RELATED POSTS


Comments/ 0


LEAVE A COMMENT

(If you're a human, don't change the following field)
Your first name.
(If you're a human, don't change the following field)
Your first name.
(If you're a human, don't change the following field)
Your first name.
But why?

My random thoughts and documentation on the various hardware and software projects that occupy my day-to-day. My only hope is that other people can benefit from my notes.

Recent posts
Categories