- cd 到当前工程目录
- touch .gitignore //在目录下生成.gitignore 文件
- open .gitignore //打开.gitignore (txt)文件
- 在.gitignore写入一下代码
# Mac OS X
*.DS_Store
:
# Xcode
*.xcworkspacedata
*.xcsettings
*.xcscheme
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
project.xcworkspace/
xcuserdata/
project.xcworkspace
xcuserdata
UserInterfaceState.xcuserstate
UserInterface.xcuserstate
# Pod
*.lock
Pods/
如果已经cocoapods的相关文件添加到缓存中,需要手动移除
- 注释:XXX指的是工程名
1.git rm -r --cached Podfile.lock
2.git rm -r --cached XXX.xcworkspace/contents.xcworkspacedata
3.git rm -r --cached XXX.xcodeproj/project.xcworkspace/contents.xcworkspacedata
4.git rm -r --cached .DS_Store
网友评论