項目進行了老長時間,今天領導看代碼發現提交文件時比較費勁,有很多不必要提交的文件,所以需要寫一個.gitignore文件來忽略一些文件,項目用git來管理源代碼,在克隆下來代碼后在項目工程的根目錄下就會有一個隱藏的.gitignore文件,如果沒有的話可以創建一個txt文本并copy到根目錄下并改名為.gitignore
一:刪除之前的緩存過的文件
git rm -r --cached ettAiXuePaiNextGen.xcworkspace/xcuserdata/LiuChuanan.xcuserdatad(這個目錄可以在SourceTree中的文件狀態中獲取)
git rm -r --cached .DS_Store
屏幕快照 2017-03-07 下午5.46.13.png
二:編輯.gitignore
vim .gitignore
三:點擊i進入編輯模式,將下列需要屏蔽的信息復制
.DS_Store
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.xcuserstate
四:點擊Esc退出編輯 :wq保存編輯內容
五:提交
git commit -m "Removed the stupid strange file that shouldn't be tracked"
六:git push