切换到git控制的程序目录 从别处拷贝 或者自己创建一个.gitignore 内容如下
Xcode
/Demo/Demo-Info.plist
.DS_Store
/build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
*.hmap
CocoaPods
Pods
保存之后,你会发现这个文件并未生效原因是因为.ignore是后来加进来的 local cache里面记录的这个文件是不忽略的 所以需要进行缓存清除
$ git rm --cached iLedger.xcodeproj/project.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate $ git commit -m "Removed the stupid strange file that shouldn't be tracked" $ git push