问题
I want to remove an entire directory with GIT ... each time I keep getting the same error and don't understand why this is happening.
I want to remove the "blue_white" folder ...
├── css
│ ├── design.css
│ └── red_white.css
├── images
│ ├── blue_white
│ │ ├── accordion-button.png
│ │ ├── accordion-shadow.png
│ │ ├── button1.png
│ │ ├── oem-slide-shadow.png
│ │ └── truncate-arrow.png
│ └── red_white
│ ├── accordion-shadow.png
└── pages.xml
When I do this ...
git rm -r blue_white/
I get this ...
fatal: pathspec 'f04/blue_white/' did not match any files
回答1:
$ rm -r images/blue_white/$ git rm -r images/blue_white/$ git commit -m 'Remove images/blue_white directory'
回答2:
It sounds like you are in the f04 directory, not the images directory.
回答3:
I just noticed that git rm deletes a directory when the last remaining file is removed.
With only myFile residing in myDir, after performinggit rm myDir/myFile
directory myDir was gone. Note that I didn't use the -r option.
回答4:
This works
git rm -r --cached blue_white
Then do a commit.
来源:https://stackoverflow.com/questions/12407899/cant-rm-folder-with-git-rm