3

How do I make git grep ignore large text files? Though I have some thousands of them, I never need to grep over them. (Think of foreign-language dictionary.) Hence, every time I do git grep I have to specify a path explicitly or cd there, because else it would take ages:

$ time git grep something somewhere/
somewhere/file.txt: something
real    0m0.049s
user    0m0.044s
sys     0m0.040s

If I could make git grep ignore said files, I would do it with less typing:

$ time git grep something
somewhere/file.txt: something
real    1m22.159s
user    0m0.472s
sys     0m1.448s

This used to be the case, but now the times are appalling. Also, I can't remove these files from git, because I need to track changes in them. Hence, adding them to .gitignore doesn't help.

sanmai
  • 29,083
  • 12
  • 64
  • 76
  • May have an answer http://stackoverflow.com/questions/359424/detach-subdirectory-into-separate-git-repository?rq=1 – sanmai Jul 30 '14 at 00:47

2 Answers2

2

I would be inclined to re-organize my project so that the large text files that are 'data' are in a different folder from where I typically grep. Does not take much effort to do and keeps the non-source code components out of the way of the day to day operations.

miltonb
  • 6,905
  • 8
  • 45
  • 55
0

Add them to your gitignore. But if this is a growing set of files you should do what miltonb suggested.

find . -size +1G | cat >> .gitignore
G--
  • 924
  • 7
  • 8
  • That doesn't help. Git still greps over ignored but *tracked* files. I need to track changes in these files. – sanmai Jul 04 '14 at 01:37