Search code examples
gitgit-log

Git log by only the filename to detect if the filename ever existed in the repo


I want to see a file with a certain name exists or ever existed in a git repo querying by only the file name (In a case where I do not know the full file path).

I can use git log --follow -- <full filepath> to see commit history of a file with full filepath even when it is removed/moved from the given file path. However I cannot do with by providing only the filename. For example,

git log --follow -- xbmc/input/AppTranslator.cpp

shows me results but,

git log --follow -- AppTranslator.cpp

doesn't show me anything.

How to detect if a filename ever existed in a git repository and get its full filepath(s) and commit history?


Solution

  • The answers from the comments were correct.

    git log --follow -- '*AppTranslator.cpp'