I had a file with special characters in the file name (umlauts). I since have renamed the file, but git
still tells me that I have 'Changes not staged for commit'. However, I can't remember the correct name of the file, and git only tells me the name is "Mu\314\210.jpg"
. I have no clue what format that is suppose to be. utf8
? I tried git rm
and copied the string, but didn't work.
How can I find out the original name of the file or how can I remove the file without knowing the exact file name (maybe with only the file extension)?
EDIT: I start to have the feeling that the file was created on a Windows PC and the encoding of the umlauts are different there. However, I can't explain why I am not able to remove the file.
I just found out that those are octal representations. Trying out the solutions from Can't remove directories git, Remove a file with a strange name from git, and Git: how to specify file names containing octal notation on the command line, however, didn't help. Especially the solution
git rm `printf "Mu\314\210.jpg"`
didn't delete the file. It still gives me "Mu\314\210.jpg" didn't match any files
. Is there some other way to remove a file?
printf
told me that "Mu\314\210.jpg"
is "Mü.jpg"
. However, the ü
octal representation on my Mac OSX should be \303\274
. That's why I suppose that the u\314\210
comes from a Windows PC. Still not sure how that helps though.
I just tried to run what the git-rm
suggests git diff --name-only --diff-filter=D -z | xargs -0 git rm --cached
. I am quiet positive now that the file can't be removed until it has been added again. I will try to get the file with the old file name and remove it then.
Ok, adding the old file didn't help either. Mac OSX seems to automatically change the octal representation. Seems like the last chance is it remove it on a Windows PC.