[英]Why is .gitignore not ignoring my files?
見下圖。 我的 .gitignore 文件應該忽略 src\/dist 中的所有文件,但不是。
對於我項目中的一些文件,我需要使用git filter-branch
,這在這個answare 中有更好的解釋。
首先檢查.gitignore
編碼。
確保編碼 id utf-8
。
然后使用git rm --cached filename
取消跟蹤不需要的文件,現在您的問題已解決 😁
如果您的 .gitignore 文件沒有忽略您的文件和目錄。
.gitignore 只是忽略尚未添加到存儲庫的文件。 如果你已經 git 添加了某些文件,它們的修改將被跟蹤。 對此類文件使用 git rm -r --cached 將它們從存儲庫中刪除(但不是從文件系統中刪除)。
git rm -r --cached . #untrack files
git add . #re-adding the files
git commit -m "issue fixed" #commiting changes
git push #pushing changes
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.