gitversion-control

With git, how do you search for a file pattern with `git log` instead of a file path?


You can limit your git log search to a file like so:

git log [branch] -- foo.c

But how would you limit the search to a file pattern instead of a full path?


Solution

  • I tend to do things like this:

    git ls-files [--with-tree=<branch>] [path] | grep '<pattern>' | xargs git log [branch]