Query git reflog for all commits to a specific file

cpjolicoeur picture cpjolicoeur · Jun 10, 2011 · Viewed 20.5k times · Source

Is it possible to check the git reflog for all commits to a specific file.

I made a commit to file foo.txt and now it no longer shows in the git history via

git log foo.txt

I want to search the reflog to find all commits to this file so I can find my "lost" commit.

Answer

Arkadiy Kukarkin picture Arkadiy Kukarkin · Mar 12, 2015

Came across this while searching for an answer, which is simple: git reflog -- $PATH, which will include amends and other actions that will not be visible otherwise (though beware, reflog will be pruned by gc)