2013-09-27 27 views
4

我不小心创建了一个名为:w的文件。我设法通过使用zsh选项卡功能来删除它。但我无法从我的git缓存中删除它。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 
+0

你尝试:'git的RM --cached -r .'? –

回答

8

找到了答案不是5分钟后

git rm '\:w' 
+0

适用于从其他无用字符开始,例如破折号。 – JakeParis