[英]How to ensure a file is completely ignored by git?
每次運行Rails測試套件后,RSpec都會將所有測試的狀態保留為spec / examples.txt。
這意味着,如果我git commit
我的登台分支,然后稍后運行測試,則即使我沒有其他文件更改,examples.txt也會被修改。
=> git checkout master
= error: Your local changes to the following files would be overwritten by checkout:
spec/examples.txt
我僅在運行測試后立即關心examples.txt,並為這些更改被覆蓋感到高興。
如何強制git忽略examples.txt而不引發此錯誤。
我的.gitignore
文件包含spec/examples.txt
。
我已經運行git rm --cached spec/examples.txt
。
我應該采取哪些其他步驟來確保git忽略對examples.txt的更改?
您可以使用更新索引指示git不在乎它
git update-index --assume-unchanged the-file
這是每個回購命令。 如果其他開發人員想要相同的行為,則也必須運行它
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.