Interview Prep/Git & GitHub/Commits, branches and tags

How do you list all commits that touched a path, including deleted files?

IntermediateConceptCommits, branches and tags
Answer

Use git log -- <path>; the double dash disambiguates paths from refs and works for deleted paths. Add --follow for a single file across renames, and --diff-filter=D to find deletion commits.

git log --oneline --diff-filter=D -- old/module.py
git log --follow -p -- src/helpers.py
All Git & GitHub questions Roadmap: Git & GitHub

More on Commits, branches and tags