Question

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
Was it helpful?

Solution

  1. $ rm -r images/blue_white/
  2. $ git rm -r images/blue_white/
  3. $ git commit -m 'Remove images/blue_white directory'

OTHER TIPS

It sounds like you are in the f04 directory, not the images directory.

I just noticed that git rm deletes a directory when the last remaining file is removed.

With only myFile residing in myDir, after performing
git rm myDir/myFile
directory myDir was gone. Note that I didn't use the -r option.

This works

git rm -r --cached blue_white 

Then do a commit.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top