Using git, how to search for a file template with `git log` instead of file path?

You can limit your git log search to this file:

 git log [branch] -- foo.c 

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

  • Note that you can run git log on another branch where the shell extension * will not work, so you cannot depend on the shell to perform file mapping.
  • Also, you cannot specify a branch with git ls-files .
+8
git version-control
source share
3 answers

I usually do things like this:

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

Or just lower the lead . i.e.: git log -- *foo.c or even git log -- ./*foo.c

+8
source share

Use the --glob .

Link: http://git-scm.com/docs/git-log

-3
source share

Source: https://habr.com/ru/post/651354/


All Articles