Odd behavior when deleting .git

I tried to remove my Git-files:

rm -R .git | yes

      

My cpu gets loud and the file is not deleted. I do not understand what is going on. How do I delete my .git files?

0


a source to share


3 answers


Try

yes | rm -r .git

      

You piped the output of rm to yes (stream left-> right), but since yes doesn't read stdin, rm just stayed there dangling.



Plus, you don't need it anyway. As the only questions you seriously want to answer "yes" in automatic mode: delete read-only files, you can use the -f ("force") option:

rm -rf .git

      

+4


a source


.git will probably have a lot of files underneath it. Try to use

$ rm -Rvf .git

      



this way it will show you which files are being deleted.

+1


a source


It looks like you are trying to deal with rm

asking for confirmation before every delete, producing output yes

that produces and infinite y's in rm, but you are doing it wrong.

rm -Rf .git      # the -f option is "force", i.e. don't ask for confirmation.

      

If you want to connect the output of one command to another, the source must come first, before the channel:

yes | head

      

+1


a source







All Articles