git – Find commit where file was added

Say I have a file foo.js that was committed some time ago. I would like to
simply find the commit where this file was first added.

After reading the answers and my own tinkering, this works for me

git log --follow --diff-filter=A --find-renames=40% foo.js

4 Answers
4

Leave a Comment