Git忽略文件配置
从里 开源的忽略文件资源 下载一份,从中gitignore.master文件中找到Objective-C.gitignore 或者 Swift.gitignore 文件。然后使用Vim编辑器修改Objective-C.gitignore 或者 Swift.gitignore 文件中需要忽略的内容,比如想要忽略pod相关内容。
- 将
Objective-C.gitignore文件拖到需要忽略的工程根目录下,然后使用vim 【Objective-C.gitignore 文件路径】,打开需要修改的文件。
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
## Other
*.moved-aside
*.xccheckout
*.xcscmblueprint
## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM
# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts
Carthage/Build
# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
# Code Injection
#
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode
iOSInjectionProject/
Objective-C.gitignore文件中# Pods/是默认不忽略的,如果想要或略pod的相关内容,将注释去掉(删掉Pod前面的#并且Pod前面不留空格) ,具体操作如下:
此时终端处于非编辑模式,使用
shift + i让终端处于可编辑模式,此时删除#与空格。删除完之后,
ESC退出编辑模式,进入非编辑模式,执行shift + :命令,进入指令对话模式,输入qw命令,保存内容 ,并退出。修改
Objective-C.gitignore文件名称为.gitignore,如果使用重命名方式修改,系统会提示你没有权限修改。所以我们要使用终端去修改cd到Objective-C.gitignore所在的根目录下,在终端执行mv Objective-C.gitignore .gitignore命令。此时我们的要做的已经完成,
.gitignore文件被隐藏掉,在终端查看.gitignore文件是否存在,cd到.gitignore文件所在的根目录,在执行ls -a命令,终端会显示所有被隐藏的文件,如果.gitignore文件存在,说明我们操作成功了。
忽略 UserInterfaceState.xcuserstate
git rm --cached [YourProjectName].xcworkspace/xcuserdata/[YourUsername].xcuserdatad/UserInterfaceState.xcuserstate
git commit -m "Removed file that shouldn't be tracked"
git push
在.gitignore 添加如下代码
*.xcuserstate
project.xcworkspace/
xcuserdata/
project.xcworkspace
xcuserdata
UserInterfaceState.xcuserstate
UserInterface.xcuserstate
SVN忽略文件配置
以CornerStone 为例子,preferences ->Subversion ->Genneral ,不要勾选Use default global ignores ,我们使用自定以忽略。
*.lo,*.la,*.al,.libs,*.so,*.so.[0-9]*,*.pyc,*.pyo,*.rej,*~,#*#,.#*,.*.swp,.DS_Store,build/,DerivedData/,*.pbxuser,!default.pbxuser,*.mode1v3,!default.mode1v3,*.mode2v3,!default.mode2v3,*.perspectivev3,!default.perspectivev3,xcuserdata/,*.moved-aside,*.xccheckout,*.xcscmblueprint,*.hmap,*.ipa,*.dSYM.zip,*.dSYM,Pods/,Carthage/Build,fastlane/report.xml,fastlane/Preview.html,fastlane/screenshots,fastlane/test_output,iOSInjectionProject/
