git clean

way to very quickly cleanup unwanted files

git clean may be used to delete all files which match gitignore, which may be very usefull, especially for big amount of small projects on a disk

git clean -ndX

will show what will be deleted

git clean -fdX

will delete everything matches gitignore

note: another way to cleanup space

Get-ChildItem -Include node_modules, bower_components, vendor, .vagrant, .vs, bin, obj, packages, .idea -Directory -Recurse -Force -ErrorAction SilentlyContinue | Remove-Item -Force –Recurse

this command will iterate over all subfolders and delete mentioned folders

example of cleaning up desktop

cd ~/Desktop

echo "Disk usage"
du -h -d 1 . | tail -n1

git init
cp ~/bitbucket.org/rabotaua/rabota.ua/.gitignore .

echo "Will be deleted"
git clean -ndX

echo "Deleting"
git clean -fdX

echo "Cleanup"
rm -rf .git .gitignore

echo "Disk usage"
du -h -d 1 . | tail -n1