git删除以冒号开头的文件
我意外地创建了一个名为git删除以冒号开头的文件,git,unix,filenames,Git,Unix,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/new
: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
#
不到5分钟就找到了答案
git rm '\:w'
您是否尝试过:
git-rm--cached-r.
?哈!谢谢你的提问和回答。让我猜猜,你使用Vim,不知怎么地键入“:w”,然后可能思维有点混乱,你又键入了“:w”。我想这会花费我超过1分钟的时间(这种方式也适用于从其他无用的角色开始,比如破折号)。
git rm '\:w'