Is it possible to Git grep a string in one file in all branches?
I know I made a change to a particular file; I just can't find which branch I did it on.
Is it possible to Git grep a string in one file in all branches?
I know I made a change to a particular file; I just can't find which branch I did it on.
Thanks to ElpieKay for providing this nice little gem:
git grep a_string $(git rev-parse --all -- target_file)
Use:
git stash
git branch | while read line
do
echo branch:$line
git checkout $line -- target_file
grep a_string target_file
done
git stash pop
Have a try.