Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to remove a folder from my Git repository with

git rm folderToRemove

but Git issues this error when I try to do so.

fatal: pathspec 'siteFiles/applicationFiles/templates/folderToRemove' 
did not match any files

My current directory is "templates." I am finding this error odd since I can cd into the folder "folderToRemove," so it clearly exists. What does this error mean?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

Git doesn't version directories, only "content" (directory content or files)

did not match any files

That means there is no file to remove within folderToRemove, as I mention in "Unable to remove files recursively from Git".
You now can remove (Windows del or Unix rm) the directory itself.

As described in "Deleting empty directories in Git", you can also run a:

git clean -fd

However:

Warning: The clean command removes any files in the current working copy that aren’t being tracked by git. This is a good way to lose your work if you haven’t added new files to git. Always run git add before git clean.

Run rather first a:

git clean -d -x -n

As explained in "How do I clear my local working directory in git?".

share|improve this answer
    
but how do I "clean" another person's remote when they do a pull? –  Ilea Cristian Jul 1 at 19:51
    
@IleaCristian due to the distributed nature of Git, you don't clean a remote, only your own clone. –  VonC Jul 1 at 20:19
    
The problem is that we don't make the final build. The project files (that the IDE sees) are actually some folders with "extension" (myproj.xcworkspace or myproj.xcodeproj). I wanted to remove the xcworkspace and leave only the xcodeproj. Basically I wanted to force the people that make the build to use only the xcodeproj file. –  Ilea Cristian Jul 1 at 20:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.