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
Browse to the directory in the repository and branch that you want to delete. In the top-right corner, click "…", and then Delete directory. Review the list of files. Depending on your permissions and the branch protection rules, choose to either commit the change directly or propose the change using a pull request.
By default, the git rm command deletes files both from the Git repository as well as the filesystem. Using the --cached flag, the actual file on disk will not be deleted.
Git rm vs rm The git rm command removes the file from both the git repository and the local file system. The rm command, on the other hand, only removes the file from the file system.
In Git, we can use git reset HEAD -- 'files/folders/patterns' to remove files or folders from the staging area (Changes to be committed).
$ rm -r images/blue_white/
$ git rm -r images/blue_white/
$ git commit -m 'Remove images/blue_white directory'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With