Skip Navigation

Can I remove a git repo without resorting to rm -rf ?

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?

42

You're viewing a single thread.

42 comments
  • If you’re that worried, why not run chmod -R u+w .git inside the project dir to “un write-protect” the files, then just ascend to the directory containing the project dir (cd ..) and use rm -r without -f?

    The force flag (-f) is the scary one, I presume?

42 comments