1

我已经使用 git rm --cached 和 git reset HEAD 删除了我的文件。但是当我尝试将它推送到我的仓库时,它仍然会添加该文件吗?我怎样才能完全删除该文件?

4

3 回答 3

2

对于将来看到这个问题的任何人,

请记住,您必须删除文件,然后提交.gitignore当前.gitignore文件才能真正忽略文件。

不手动删除文件将导致现有文件保留在 repo 中,但添加的新文件将被忽略。

于 2016-11-23T00:11:13.360 回答
0
git rm <filename> will keep track of your file that you are deleting a file which is there in git repo and keeps track yes the behavior is right.

对你来说,你需要正常删除它 rm -rf will delete the file now 。现在做 git status 和不添加删除的文件然后commit 推送它。它将按您的预期工作。

于 2016-11-22T18:28:55.843 回答
0

是我的错。在 git rm -- 缓存之后我没有使用 git commit 。

于 2016-11-22T18:23:01.183 回答