I have a piece of code in another than my current branch in my git repo, and I am not sure which commit and which branch. How can I search in all files that I committed until now for a specific string (and afterwards show the surrounding of that line of code)?
Share
Use
git grepto locate the commit:The
git rev-list --allmakes it search the entire history of the project.That will give an output like this:
Then you can use
git branch --containsto find out which branch the commit is on: