「Git Ignore」的作用是告訴 Git 在版本控制時忽略指定的檔案或目錄。這些被忽略的檔案通常是一些不應該被提交到程式庫中的臨時檔案、日誌檔案、快取檔案等等。通過在程式庫的根目錄建立一個名為「.gitignore」的檔案,並在其中指定要忽略的檔案或目錄,Git 就會自動忽略這些檔案。這可以使程式庫更加乾淨、易於維護,並且避免了一些不必要的衝突。
vi .gitignore
notepad .gitignore
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
git push
附錄:
Visual Studio的 .gitignore 範例:https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
https://cynthiachuang.github.io/Set-Gitignore-File/
https://cynthiachuang.github.io/Ignore-Tracked-Files-in-Git/