git删除以冒号开头的文件

Har*_*eno 6 unix git filenames

我不小心创建了一个名为的文件:w.我设法通过使用zsh选项卡功能删除它.但我不能从我的git缓存中删除它.

    git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   modified:   Gemfile
#   modified:   Gemfile.lock
#   new file:   config/newrelic.yml
#
# Changes not staged for commit:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   deleted:    :w
#
Run Code Online (Sandbox Code Playgroud)

然后

git rm :w
fatal: pathspec 'w' did not match any files
Run Code Online (Sandbox Code Playgroud)

Har*_*eno 10

5分钟后才找到答案

git rm '\:w'
Run Code Online (Sandbox Code Playgroud)