views:

109

answers:

3

I tried to remove my Git-files:

rm -R .git | yes

My CPU becomes loud, and no file is removed. I cannot understand what is going on. How can I remove my .git-files?

+3  A: 

Try

yes | rm -r .git

You were passing the output of rm to yes (flow is left->right), but as yes does not read stdin, rm was just left hanging there.

Also, you do not really need yes anyway. As the only questions you seriously want to answer with 'yes' in an automated fashion are whether to delete read-only files, you can use the -f parameter ('force'):

rm -rf .git
dseifert
Ah yes brilliant bug fix heh...
TokenMacGuy
+1  A: 

.git is likely to have a lot of files under it. Try using

$ rm -Rvf .git

that way it will show you what files are being deleted.

TokenMacGuy
+1  A: 

It looks like you're trying to deal with rm asking for confirmation before each deletion by piping the output of yes, which produces and infinite number of "y" characters into rm, but you're doing it wrong.

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

If you want to pipe the output of one command into another, the source has to come first, before the pipe:

yes | head
bendin