Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (29.3k points)

I know git stores information of when files get deleted and I am able to check individual commits to see which files have been removed but is there a command that would generate a list of every deleted file across a repository's lifespan?

1 Answer

0 votes
by (50.2k points)

For listing all deleted files you could use:

git log --diff-filter=D --summary

And for info, you can see this answer: https://intellipaat.com/community/3107/find-and-restore-a-deleted-file-in-a-git-repository?show=3107#q3107

If  you don’t need more details on which commit they were removed you could simply use:

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

Warning: This lists all files which you've deleted. If you've deleted a file, then created a new file with the same name, it will show up on this list, even though there's a file with that name.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...