gitignore文件在Android项目中的配置(使用Eclipse开发):
# built application files *.apk *.ap_ # files for the dex VM *.dex # Java class files *.class # generated files bin/ gen/ # Local configuration file (sdk path, etc) local.properties # Eclipse project files .classpath .project .DS_Store
.gitignore文件在iOS项目中的配置:
# local file local/ # OS X .DS_Store # Xcode build/ *.pbxuser !default.pbxuser *.mode1v3 !default.mode1v3 *.mode2v3 !default.mode2v3 *.perspectivev3 !default.perspectivev3 xcuserdata *.xccheckout profile *.moved-aside DerivedData *.hmap *.xccheckout # CocoaPods Pods
.gitattributes文件的配置:
*.pbxproj text -crlf -diff -merge=union
注意:
.gitignore .gitattributes文件都是在版本库根目录下放置的;
如果只配置了gitignore文件,还会有一个问题:xcode中的project.pbxproj冲突解决起来很麻烦,具体参考:http://www.zhihu.com/question/19763504
参考几种意见后决定使用gitattributes来解决这个问题,同时对于项目的文件结构最好由一个人来负责配置。
参考:
http://segmentfault.com/q/1010000000202016
http://stackoverflow.com/questions/2729109/should-i-merge-pbxproj-files-with-git-using-merge-union
http://git-scm.com/book/zh/%E8%87%AA%E5%AE%9A%E4%B9%89-Git-Git%E5%B1%9E%E6%80%A7