GIT RM file with leading space character in the file name

I need help with git problem.

I managed to create a file with a space at the beginning of its name. I also have the same file with no space. When I first created the file with a single space, I added it and transferred it to my local repo.

if I do git rm, it deletes the file that I want to cep, and not the file that I want to get rid of.

How can I get rid of the version with a leading single space in the file name.

Hi

Gus Denton Uni New South Wales

+3
source share
1 answer

Run every space with a slash, for example:

$ la
total 20
drwxr-xr-x  3 stevek stevek 4096 2011-06-07 22:50 ./
drwxr-xr-x 40 stevek stevek 4096 2011-06-07 22:50 ../
drwxr-xr-x  8 stevek stevek 4096 2011-06-07 22:50 .git/
-rw-r--r--  1 stevek stevek    5 2011-06-07 22:50   test.txt
-rw-r--r--  1 stevek stevek    5 2011-06-07 22:50 test.txt

$ git rm \ \ test.txt
rm '  test.txt'

$ git commit -m'removed'
[master 8e629e2] removed
 1 files changed, 0 insertions(+), 1 deletions(-)
 delete mode 100644   test.txt

$ la
total 16
drwxr-xr-x  3 stevek stevek 4096 2011-06-07 22:51 ./
drwxr-xr-x 40 stevek stevek 4096 2011-06-07 22:50 ../
drwxr-xr-x  8 stevek stevek 4096 2011-06-07 22:51 .git/
-rw-r--r--  1 stevek stevek    5 2011-06-07 22:50 test.txt
+8
source

All Articles