Take the 2-minute tour ×

Is there a way to perform a full text search of a subversion repository, including all the history?

For example, I've written a feature that I used somewhere, but then it wasn't needed, so I svn rm'd the files, but now I need to find it again to use it for something else. The svn log probably says something like "removed unused stuff", and there's loads of checkins like that.

share|improve this question
Apache Subversion 1.8 accepts --search argument for svn log command. See my answer at stackoverflow.com/a/17473516/761095 –  bahrep Jul 4 '13 at 15:06

13 Answers 13

up vote 42 down vote accepted
git svn clone <svn url>
git grep < some regex >
share|improve this answer
Good point. The gitk GUI does this kind of search very well, and it's easy to use the git svn tools to access an svn repository. Admitedly, I've moved entirely to using git since the time I asked this question, so accepting this answer might be a bit specific to me. –  rjmunro Sep 29 '10 at 14:08
If you want to just search the commit messages, use git log --grep regex. –  Limited Atonement Oct 17 '13 at 19:26

If you are running Windows have a look at SvnQuery. It maintains a full text index of local or remote repositories. Every document ever committed to a repository gets indexed. You can do google-like queries from a simple web interface.

share|improve this answer

I'm using a small shellscript, but this only works for a single file. You can ofcourse combine this with find to include more files.

for REV in `svn log $1 | grep ^r[0-9] | awk '{print $1}'`; do 
  svn cat $1 -r $REV | grep -q $2
  if [ $? -eq 0 ]; then 
    echo "$REV"

If you really want to search everything, use the svnadmin dump command and grep through that.

share|improve this answer
+1 for the admin dump pointer. –  akuhn Jan 26 '10 at 10:44
I had to remove the "r" from revisions numbers with: awk '{print substr($1,2,length($1))}' and remove the grep "-q" option, to actually show the matches. –  Hugo Dec 6 '10 at 13:57
strings myDump.txt | grep "turtle fwd 10" –  jedierikb Jul 14 '12 at 2:31
And this is why we embrace git. –  Limited Atonement Oct 17 '13 at 19:27

The best way that I've found to do this is with less:

svn log --verbose | less

Once less comes up with output, you can hit / to search, like VIM.


According to the author, he wants to search more than just the messages and the file names. In which case you will be required to ghetto-hack it together with something like:

svn diff -r0:HEAD | less

You can also substitute grep or something else to do the searching for you. If you want to use this on a sub-directory of the repository, you will need to use svn log to discern the first revision in which that directory existed, and use that revision instead of 0.

share|improve this answer
That's not full text searching, it's searching the logs and filenames. –  rjmunro Sep 7 '08 at 14:09
If that is the case, then you need to use more expressive commit logs. If you want to grep the difference between revisions, that is whole other ball of wax. And I personally do not know a way to do that. –  Jack M. Mar 23 '09 at 18:11

I have been looking for something similar. The best I have come up with is OpenGrok. I have not tried to implement it yet, but sounds promising.

share|improve this answer
I've been using OpenGrok for several months, it rocks. –  Mauricio Scheffer Sep 29 '08 at 16:16

svn log in Apache Subversion 1.8 supports a new --search option. So you can search Subversion repository history log messages without using 3'rd party tools and scripts.

svn log --search searches in author, date, log message text and list of changed paths.

See Apache Subversion 1.8 Release Notes.

share|improve this answer
Handy, but not full-text search. I'm sticking with the git-svn answer :-) –  rjmunro Jul 4 '13 at 19:10
Not that at the moment svn repos on googlecode are still running on svn 1.6... see: code.google.com/p/support/wiki/…? But, updating your client to 1,8 (and svn upgrade of any checked out repo) will allow you to use svn log --search on the repo... –  Mario Ruggier Aug 15 at 11:05

I was looking for the same thing and found this:


share|improve this answer

While not free, you might take a look at Fisheye from Atlassian, the same folks that bring you JIRA. It does full text search against SVN with many other useful features.


share|improve this answer
Fisheye's pretty good. As you say, not free, but the <=10 committer license is only $10/year. –  Jason S Nov 30 '10 at 18:47

I don't have any experience with it, but SupoSE (open source, written in Java) is a tool designed to do exactly this.

share|improve this answer

I just ran into this problem and

svnadmin dump <repo location> |grep -i <search term>

did the job for me. Returned the revision of the first occurrence and quoted the line I was looking for.

share|improve this answer
Works only for local path. –  Yugal Jindle Jun 5 '12 at 7:31
Works only locally and will take a lot of time if a repository is large. –  bahrep Jul 4 '13 at 15:13

I usually do what Jack M says (use svn log --verbose) but I pipe to grep instead of less.

share|improve this answer
That is what I usually end up doing, but I've found that with less you can actually see the revision, date, etc instead of just the line in the comment. That is usually what I'm looking for anyway. –  Jack M. Mar 23 '09 at 18:10

I wrote this as a cygwin bash script to solve this problem.

However it requires that the search term is currently within the filesystem file. For all the files that match the filesystem grep, an grep of all the svn diffs for that file are then performed. Not perfect, but should be good enough for most usage. Hope this helps.


# Usage: svngrep $regex @grep_args

pattern=`echo $regex | perl -p -e 's/--?\S+//g; s/^\\s+//;'` # strip --args
if [[ ! $regex ]]; then
    echo "Usage: svngrep \$regex @grep_args"
    for file in `grep -irl --no-messages --exclude=\*.tmp --exclude=\.svn $regex ./`;     do 
        revs="`svnrevisions $file`";
        for rev in $revs; do
            diff=`svn diff $file -r$[rev-1]:$rev \
                 --diff-cmd /usr/bin/diff -x "-Ew -U5 --strip-trailing-cr" 2> /dev/null`
            context=`echo "$diff" \
                 | grep -i --color=none   -U5 "^\(+\|-\).*$pattern" \
                 | grep -i --color=always -U5             $pattern  \
                 | grep -v '^+++\|^---\|^===\|^Index: ' \
            if [[ $context ]]; then
                info=`echo "$diff" | grep '^+++\|^---'`
                log=`svn log $file -r$rev`
                #author=`svn info -r$rev | awk '/Last Changed Author:/ { print $4 }'`; 

                echo "$log"
                echo "$info"
                echo "$context"


# Usage:  svnrevisions $file
# Output: list of fully numeric svn revisions (without the r), one per line

    svn log "$file" 2> /dev/null | awk '/^r[[:digit:]]+ \|/ { sub(/^r/,"",$1); print  $1 }'
share|improve this answer
'A' for effort! (just use git :)) –  Limited Atonement Oct 17 '13 at 19:30

I came across this bash script, but I have not tried it.

share|improve this answer

Your Answer


