I am trying to use git grep
to search all revisions of a very large repository. The command I am using is:
$ git rev-list --all | xargs git grep -I --threads 10 --line-number \
--only-matching "SomeString"
I am using the latest official version of git on mac:
$ git --version
git version 2.19.1
It's taking a very long time, looking at activity monitor git is only using one thread. However the docs say it should use 8 by default. It only uses one thread with or without the --threads <num>
option. I don't have any other config set that would override this setting either:
$ git config --list
credential.helper=osxkeychain
user.name=****
user.email=****
Any ideas what I'm missing? Can anybody else use git-grep
and confirm that they see multiple threads?
Thanks for any help
I wonder if it's because you're using
| xargs
, which waits for input onstdin
. Since the output fromgit rev-list
is a single stream, xargs, by default will use only one process:So try increasing it using the above flag:
This will spawn multiple
git grep
s, rather that enablegit grep
to use multiple threads, so a sort-of-functional answer.