git對已有檔案進行忽略提交
阿新 • • 發佈:2018-12-10
1、場景描述
本地開發Django專案argus,/argus/settings.py檔案因有資料庫地址不想根據版本每次進行提交。
2、具體操作
2.1、到git根目錄,找到.gitignore檔案並開啟,新增內容:
/argus/settings.py
2.2、提交.gitignore檔案:
git add .gitignore
git commit -m 'test'
2.3、清空快取臨時(對於已經新增在版本庫的檔案,需要清空處理)
git rm -r --cached . #結尾有點
git add . #結尾有點
git commit -m 'update .gitignore'
3、測試效果
git status #顯示clean關鍵字表示配置生效。
4、強制提交 git add -f /arugs/settings.py
參考url:
https://www.cnblogs.com/sloong/p/5523244.html