10

我不小心创建了一个名为: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
#

然后

git rm :w
fatal: pathspec 'w' did not match any files
4

1 回答 1

13

不到 5 分钟就找到了答案

git rm '\:w'
于 2013-09-27T19:54:27.887 回答