美文网首页
.gitignore文件不启作用

.gitignore文件不启作用

作者: Deng_1957C | 来源:发表于2022-09-18 18:04 被阅读0次

问题:
.gitignore只能忽略那些原来没有被track(之前没有add过)的文件,
如果某些文件已经被纳入了版本管理中,则修改.gitignore是无效的。

解决方案:
先把本地缓存删除(改变成未track状态),然后再提交:
git rm -r --cached target
git rm -r --cached .idea

    报错加 -f
    the following file has staged content different from both the file and the HEAD:.idea/.gitignore
    (use -f to force removal)
    git rm -r -f --cached .idea

相关文章

网友评论

      本文标题:.gitignore文件不启作用

      本文链接:https://www.haomeiwen.com/subject/bmbportx.html