如何从git repo中删除文件?

时间:2018-05-10 04:31:54

标签: git

似乎无法从git中删除文件。

我视力不佳,有人能发现我做错了吗?

编辑:它是一种类型。我正在删除错误的文件:(

感谢

D:\ray\dev\ml\titanic>git rm .ipynb_checkpoints/tryunitesting.ipynb
fatal: pathspec '.ipynb_checkpoints/tryunitesting.ipynb' did not match any files


D:\ray\dev\ml\titanic>git rm .ipynb_checkpoints\tryunitesting.ipynb
fatal: pathspec '.ipynb_checkpoints\tryunitesting.ipynb' did not match any files


D:\ray\dev\ml\titanic>ls .ipynb_checkpoints
tryunitesting-checkpoint.ipynb

D:\ray\dev\ml\titanic>

1 个答案:

答案 0 :(得分:0)

git rm file1.txt
git commit -m "remove file1.txt"

但是如果你只想从Git存储库中删除文件而不是从文件系统中删除它,请使用:

git rm --cached file1.txt
git commit -m "remove file1.txt"

并将更改推送到远程仓库

git push origin branch_name  

看来你的问题是typo。为了避免像这样的简单错误,你可以使用一些shell插件。请检查this great plugin

相关问题