Search changes to a filename pattern in Git history
Posted on
October
11, 2020
This is yet another “search in Git” TIL entry. You could say that Git has a unintuitive CLI, or that is it very powerful.
I wanted to search for an old file that I new that was in the history of the repository, but was deleted some time ago. So I didn’t really remember the name, only bits of it.
I immediately went to the list of TILs I had written on searching in Git, but it wasn’t readily obvious how to do it, so here it goes:
1
git log -- *pattern*
You could add globs before the pattern to match things on any directory, and add
our -p
friend to promptly see the diffs:
1
git log -p -- **/*pattern*