git 刪除錯誤提交的文件

idea 項目 ,錯誤將 工具生成的 .idea 裏的文件提交到 倉庫
想要倉庫裏刪除該文件,而本地繼續保留
可以用如下git 命令

git rm --cached filename

看看該參數的說明

       --cached
           Use this option to unstage and remove paths only from the index. Working tree files, whether modified or not,
           will be left alone.

參考地址
http://www.findme.wang/share/detail/id/437.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章