1

I am on linux (mint mate 17.2), I wrote a simple shell script that call git grep -e to help me to search a sub directory of a git repository, it works well.

When I changed the name of the sub directory, e.g from language to 4-1.language, then I modify the script accordingly.

Then the script won't give any search result, while it should, after try for several times, I guess it's a kind of cache.

I reboot my computer, then the new version of script works.

My question is:

Which part did the cache? Is that git or bash script or .. ?

And how could I make the script work without restart my computer?

@Update

I kind found the reason, it seems if I modify the sub directory name, without commit, then git grep -e can't search neither of the old or new name, after I commit it, I can search the new name with expected result.

Eric
  • 22,183
  • 20
  • 145
  • 196

1 Answers1

1

Are you sure you commit the new directory before using your script ?

It looks only in the tracked files

Look for specified patterns in the tracked files in the work tree

If you rename subdirectory and did not add it to the track then git grep will not find it.

Andriy Kuba
  • 8,093
  • 2
  • 29
  • 46
  • Yes, I guess that's the reason, it seems when modified and not commit, it can't search neither old or new folder ... – Eric Sep 21 '15 at 05:36
  • 1
    try to rename by git command, like "git mv " - http://stackoverflow.com/questions/11183788/in-a-git-repository-how-to-properly-rename-a-directory – Andriy Kuba Sep 21 '15 at 05:39