A colleague was asking:
I’m trying to work out a technique for searching for an occurrence of a phrase in _all_ revisions of a specific file in a subversion repository. How can I do this?
Of course, in subversion, the answer is slow and complicated. But, you can use git (and git svn in particular) to achieve the answer fairly simply (and much more quickly).
First, you just clone the subversion repository into git. This takes a while, mostly because subversion isn’t that quick.
git clone -s https://svn.example.com/proj
Then, you can wrap a little bit of shell scripting around git to get what you need.
cd proj git branch -a | grep tags/ | while read tag do git --no-pager grep 'something' $tag -- some/file.txt done
So, we pull out a list of tags, and run git grep over each one.
There may well be a more effective way to do this, but hey, it took seconds to come up with. And it shows off the reason I like git — it’s so scriptable.