git分為全域設定和局部設定(Repo內) 忽略空白處變化,如果是寫python的話就不能忽略空白處變化 基於讓每個環境都有一致的呈現結果,我也不建議忽略空白處變化 git config --global apply.whitespace nowarn 有些git下載回來設定檔裡面有no-fast-forward的設定,會阻止我們用force push修改以前的修正 git config branch.master.mergeoptions "--no-ff" 如果想拿掉某個config就用unset來取消設定 git config --unset branch.master.mergeoptions 若主要是在ubuntu中開發, 而偶爾會在windows上開發,建議windows部份設定忽略檔案的屬性改變,以及讓git自動轉換換行字元(CRLF->LF) 非常不建議同一份git目錄在windows開發又搬移到linux上開發, 因為會有換行/權限/等等的問題 git config --global core.fileMode false # In Windows/Mac, push/pull convert the line feed git config --global core.autocrlf true # In Ubuntu/Linux,convert CRLF to LF while push git config --global core.autocrlf input Ref:https://help.github.com/articles/dealing-with-line-endings/ Windows CRLF => \r\n Linux LF \n Mac CR \r 檢查文件是否混合兩種換行方法,若有就會拒絕commit, 因為換行會成script無法正確的parsing,所以我會建議設定這個 git config --global core.safecrlf true 如果檔案被拒絕,可以用dos2unix將檔案的換行符號換成unix的LF 如果你修改了上面這些設定,請確保你的git目錄內的檔案都是一致的 git rm --cac...