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/