1

I have been playing around with submodules from git and installed my first one in the wrong directory. Fixed easily enough, but when trying to delete recursively, I put the arguments/files in the wrong order and now I have a directory named --force.

I have tried various commands to remove it, among them -rf (Yes, I know the dangers of it) but I can't seem to get rid of this directory. Instead, bash thinks that I'm calling an argument and does nothing.

I remember having this problem before, and my teacher told me to back out of the directory and delete it from a directory above, but I have also tried that to no avail. Again, bash thinks I'm referring to an argument.

I seem to have gotten myself in quite a pickle. I know the solution is super simple but I can't seem to figure it out for myself. Any suggestions?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Claem
  • 51
  • 4

1 Answers1

0

You can try a

git rm -r -- --force

(instead of just rm)

That will not only remove it from the working tree, it will also removes it from the git index.
If that folder wasn't added to the index, then rm -rf -- --force is enough)

See "Deleting a badly named git branch" for the explanation of the double hyphen syntax: it separates the command from the file arguments.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250