一、關于.gitignore,這里不再贅述,GitHub上有所有的例子:https://github.com/github/gitignore
二、關于忽略文件有時候都無法忽略的某些文件:.DS_Store和UserInterfaceState.xcuserstate,是不是就想把它們全部殺掉!多謝大神支持,現提供兩條正確的刪除命令(注意:刪除這兩文件不會影響項目)。
刪除項目中所有的.DS_Store文件
進入項目位置后,運行命令:
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
刪除UserInterfaceState.xcuserstate
進入項目位置后,運行命令:
git rm --cached 項目名稱.xcworkspace/xcuserdata/我的終端用戶名稱.xcuserdatad/UserInterfaceState.xcuserstate
然后提交修改即可。