Git repos have lots of write protected files in the .git directory, sometimes hundreds, and the default rm my_project_managed_by_git will prompt before deleting each write protected file. So, to actually delete my project I have to do rm -rf my_project_managed_by_git.
Using rm -rf scares me. Is there a reasonable way to delete git repos without it?


If you’re scared to do
rm -rf, do something else that lets you inspect the entire batch of deletions first. Such as:find .git ! -type d -print0 | xargs -0 -n1 echo rm -fvThis will print out all the
rm -fvcommands that would be run. It’s basicallyrm -rf --dry-run, butrmdoesn’t have that common option. Once you’ve verified that that’s what you want to do, run it again withoutechoto do the actual deletion. If you’re scared of having that in your history, either use a full path for .git, or prepend a space to the non-echo version of the command to make it avoid showing up in your shell history (assuming you have ignorespace in your HISTCONTROL env var)I use this
xargs echopattern a lot when I’m crafting commands that are potentially destructive or change lots of things.