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?

  • nighty@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    5 months ago

    Maybe you can create a bash function (and add it to your bash config files) that only executes the rm -rf command we have a .git file around?

    function git-rm {
      if [ -d "$1" ] && [ -d "$1/.git" ]
      then
        rm -rf $1;
      fi
    }