Find commit in which file was deleted

2

I have a project in Git. I need to recover a file that was deleted several months ago.

If something were now in the repository, it would be trivial to find it, see its history and changes. But as it's something that has been removed, I'm having trouble getting the last version of the file prior to its deletion.

For lack of a better alternative, I think to do a binary search on the commits ... But I'll be very grateful (and I believe many others will) if they establish more efficient way to find the < in> commit where something that was removed.

    
asked by anonymous 21.11.2014 / 21:26

1 answer

2

If you know the path of the file that was deleted, use:

git log --all -- <arquivo>

If not, use:

git log --diff-filter=D --summary | grep delete

Reference: here .     

21.11.2014 / 21:31