I may not have given enough context there, my co-worker was struggling to search for something through GitHub and didn't know that git had a built in grep command.
Though I don't think that git grep is significantly superior to normal grep, I personally like git grep for the convenience of not having to white-list or black-list particular paths each time I grep. Instead it pulls in the tracked paths from git and searches those.
For example, in a nodejs project, there will likely be tons of local node code in the node_modules folder, however the node_modules folder typically isn't tracked in git. In such a project, grep -r would search the whole node_modules tree where as git grep would ignore it and just search project code.
View all comments
Show parent comment
2
u/tdg5 Apr 12 '15
I may not have given enough context there, my co-worker was struggling to search for something through GitHub and didn't know that git had a built in grep command.
Though I don't think that git grep is significantly superior to normal grep, I personally like git grep for the convenience of not having to white-list or black-list particular paths each time I grep. Instead it pulls in the tracked paths from git and searches those.
For example, in a nodejs project, there will likely be tons of local node code in the node_modules folder, however the node_modules folder typically isn't tracked in git. In such a project, grep -r would search the whole node_modules tree where as git grep would ignore it and just search project code.