Here’s a simple trick I just learned.
Say you want to have a list of git commits that affected a certain file type. As in my case, I needed to check when was the last time an SQL file was added or changed in the repository.
-- operator in
git log for this. For example:
git log -- *.sql
Then you’ll get a list with commits that affected files matching the
*.sql pattern, like so:
rtuin@mpb ~/projects/someproject (master) $ git log -- *.sql
Date: Thu Jul 13 12:18:41 2017 +0300 Some commitcommit 070c09ef966609b105459e4330ef3b2e1248ca16
Date: Tue Jul 4 16:19:05 2017 +0200 Some other commitcommit 69ebb36154d350ee6bda7aa78ed6353590cc36e1
Date: Wed Jun 28 16:35:43 2017 +0300 Some other other commit
Some explanation on the
-- operator, as taken from the git-log manual:
Show only commits that are enough to explain how the files that match the specified paths came to be. See History Simplification below for details and other simplification modes.