how can I find tá commit in git log when a certain file was deleted, but I only know the…
- User
how can I find tá commit in git log when a certain file was deleted, but I only know the name and not the full path
Assistant
Here are a few ways to find the commit in git log where a file was deleted by name:
- Search git log and grep for the delete action:
git log --all --grep="delete" --name-only | grep <filename>- Use
--diff-filter=Dto show only deleted files in git log:
git log --diff-filter=D --summary | grep <filename>- Search git log for the commit where the file no longer appears:
git log --pretty=oneline --name-only | grep <filename>- Use Git's pickaxe option to search for commits where a string was removed:
git log -S<string in file>- Use a visual git log browser like gitk or git gui and search/filter on the filename.
The commit where the file no longer appears in git log is likely when it was deleted.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.