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?

  • treadful@lemmy.zip
    link
    fedilink
    English
    arrow-up
    2
    ·
    4 months ago

    Using rm -rf scares me. Is there a reasonable way to delete git repos without it?

    I don’t know what to tell you, that’s the command you need to use.

    If you’re that worried you’re going to nuke important stuff, make backups, and don’t use sudo for user files.

  • ssm@lemmy.sdf.org
    link
    fedilink
    arrow-up
    1
    ·
    4 months ago

    use relative paths (cd into the directory below your repository) and use tab completion, and you won’t have problems.

    • Buttons@programming.devOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      edit-2
      4 months ago

      More like, I’m afraid of the command doing more than I’m trying to do.

      What I want to do is ignore prompts about write-protected files in the .git directory, what it does is ignore all prompts for all files.

          • CarrotsHaveEars@lemmy.ml
            link
            fedilink
            arrow-up
            0
            ·
            4 months ago

            Generally that is not a concern because regular users won’t be able to rm anything else other than those in his own $HOME.

            Another thing I want to say is, command line is for careful users. If someone is careless, they should create a wrapper around rm, or just use a FM.

            • ffhein@lemmy.world
              link
              fedilink
              arrow-up
              1
              ·
              4 months ago

              If someone is careless, they should create a wrapper around rm, or just use a FM.

              I think that’s the situation OP is in… They don’t trust themself with these kinds of commands, while other commenters here are trying to convince them that they should just use rm -rf anyway

  • Kekin@lemy.lol
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    4 months ago

    A tip I saw some time ago is to do:

    rm folder -rf

    Additionally you could move the git folder to the trash folder. I think it’s usually located at $HOME/.local/share/trash/files/

    Then you can delete it from the trash once you’re certain you got the right folder

    • d_k_bo@feddit.de
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      4 months ago

      Additionally you could move the git folder to the trash folder. I think it’s usually located at $HOME/.local/share/trash/files/

      Moving something to the trash files folder isn’t the correct way to trash it, since the Trash specification requires storing some metadata for each trash item.

      You should use eg. trash-cli instead.

    • Buttons@programming.devOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      4 months ago

      That’s a good suggestion for some, but I’m quite comfortable with the command line.

      It’s not that I’m irrationally scared of rm -rf. I know what that command will do. If I slow down an pay attention it’s not as though I’m worried “I hope this doesn’t break my system”.

      What I really mean is I see myself becoming quite comfortable typing rm -rf and running it with little thought, I use it often to delete git repos, and my frequent use and level of comfort with this command doesn’t match the level of danger it brings.

      Just moving them to /tmp is a nice suggestion that can work on anywhere without special programs or scripts.