On Thu, Oct 27, 2016 at 7:50 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote: > > Unless you are imagining "git grep" to initialize and checkout a > submodule that is not checked out on-demand, I do not think you have > any reason to even look at ".gitmodules" for the purpose of "I want > to grep both in superproject and submodules that are checked out." In tree-ish mode you may have this example: git -C superproject rm path/to/submodule git -C superproject commit -a -m "delete submodule" ... time passes ... git -C superproject grep --recurse-submodule -e <expression> \ HEAD~42 path/to/submodule In the last command you need to map the path to submodule to the name of the submodule to find out the place of the object store for that submodule and see if it exists. > If it is working with a tree-ish, again, go look at the object store > in that submodule repository. and to find out the object store for that submodule you need the path -> name mapping at that point in time, i.e. you want to look at the .gitmodules file at the given tree-ish.