开发者

GIT RM a file with a leading whitespace character in filename

I need help with a git issue.

I have managed to create a file with a space at the beginning of it'开发者_如何学Cs name. I also have the same file without the space. When I first created the file with the single space I added it and committed it to my local repo.

if I do a git rm it deletes the file I want to kepp not the file I want to get rid of..

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

Regards

Gus Denton Uni of New South Wales


Escape each 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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜