Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Impossible to git rm with special characters

I added files in my git repository that I want to remove now. I deleted it with rm XXX. Now, git status shows me:

Changed but not updated:
    deleted:    "Sche\314\201ma application + interface.graffle"

No matter how I git rm it, I still have a :

fatal: pathspec 'Schêma application + interface.graffle' did not match any files

I tried to escape whitespaces with \, to escape \ with \\, to escape " with \". No matter what I tried, it failed.

Do you have hints?

like image 434
kheraud Avatar asked Oct 18 '11 17:10

kheraud


People also ask

How do git rm and rm differ from each other?

Git rm vs rmThe 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.

Does git rm actually delete the file?

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.

What does the git command git rm do?

The git rm command can be used to remove individual files or a collection of files. The primary function of git rm is to remove tracked files from the Git index. Additionally, git rm can be used to remove files from both the staging index and the working directory.

How do I use git rm?

Command line Git repository delete Just run the rm command with the -f and -r switch to recursively remove the . git folder and all of the files and folders it contains. This Git repo remove command also allows you to delete the Git repo while allowing all of the other files and folder to remain untouched.


2 Answers

This will detect the remove:

git add -u
like image 101
Geo Avatar answered Oct 10 '22 23:10

Geo


try git gui. You could probably escape it properly but it might be too much trouble than it's worth. It should escape this properly.

If your issue is staging removals, just git add -A to add all changes to the index.

like image 23
Adam Dymitruk Avatar answered Oct 10 '22 23:10

Adam Dymitruk