Show history of changes to files based on a wildcard e.g. *.vcxproj

Viewed 44

Somewhere, changes to a project file or similar is causing build issues but there have been a lot of changes from various branches and it's not immediately obvious where or when

Is there a way I can get git to simply list in reverse order, each time a file matching a wildcard has been modified, e.g. *.sln, *.vcxproj, so I can troubleshoot each commit more easily?

1 Answers

Yes.

Just filter your log with -- <path> [<other/path>] to restrict the commits output to the ones which modify (in any way, modification, creation, deletion...) said path(s). Wildcards are allowed. (see doc)

git log -- *.sln *.vcxproj

And of course you can then throw in here any comfort options you want (here --oneline for example, but adapt to your needs), including --reverse. You'll also probably want to use --all to search on every branch, not only on the currently checked out one.

Just be sure to have only paths after the --, any option has to be given before it.

git log --reverse --oneline --all -- *.sln *.vcxproj

(Note: double-quote your paths when they happen to contain whitespace)
(In some shells, even without whitespace, you'll also have to double-quote to avoid premature expansion of the wildcard)

Related