Skip to main content

Delete any file mentioned in .gitignore [Resolved]

I have the following entries in a .gitignore file and I want to remove them. The reason why is because these files are temporary-junk files created during a TeX compilation and I want to be able to remove them.

How I can do that?

Question Credit: Dimitrios Desyllas
Question Reference
Asked September 21, 2019
Posted Under: Unix Linux
3 Answers

In your case if the files entries in your .gitignore are not starting with ! then this one-liner should be fine to you:

while read -r entry;do rm -rf ${entry}; done < .gitignore

credit: Dimitrios Desyllas
Answered September 21, 2019
Your Answer