Last Updated: July 24, 2020
·
1.53K
· mlen

Removing files from git

Removing untracked files can be hard, so there is one-liner for that:

git ls-files --exclude-standard --other | xargs rm -f 

Above line removes only untracked files. For removing ignored files run that:

git ls-files --ignored --exclude-standard --other | xargs rm -f

To remove both untracked and ignored files run this:

git ls-files --other | xargs rm -f