Reputation: 25815
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?
git log
on another branch, where shell
expansion of *
won't work, so you
can't depend on the shell to do the
file pattern matching.git ls-files
.Upvotes: 13
Views: 9265
Reputation: 496902
I tend to do things like this:
git ls-files [--with-tree=<branch>] [path] | grep '<pattern>' | xargs git log [branch]
Upvotes: 13
Reputation: 1314
Or just drop the leading .
, i.e.:git log -- *foo.c
, or even git log -- ./*foo.c
Upvotes: 14