欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

iOS 配置.gitignore文件详细介绍

程序员文章站 2024-02-13 08:54:58
ios 配置.gitignore文件详细介绍 为什么要配置.gitigore 在我们使用git的过程当中,不是任何文件都需要commit到本地或者远程仓库的,比如一些三...

ios 配置.gitignore文件详细介绍

为什么要配置.gitigore

在我们使用git的过程当中,不是任何文件都需要commit到本地或者远程仓库的,比如一些三方库文件。
那么作为一个git新手,很多人不知道如何配置.gitignore文件,本文只是提供一个便捷的例子。你可以直接使用本文提供的代码编辑到你的.gitigore文件中。

简便配置

直接复制下面的内容到你的.gitignore文件即可。注意,这个配置是给ios开发者使用的。

# xcode
.ds_store
*/build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
profile
*.moved-aside
deriveddata
.idea/
*.hmap
*.xccheckout
*.xcworkspace
!default.xcworkspace

#cocoapods
pods
!podfile
!podfile.lock

到gitignore.io去选择自定义配置

gitignore.io 输入你需要配置的语言,会帮助你自动生成一份配置。比如,输入objective-c和swift会帮助你生成下面的配置。

# created by https://www.gitignore.io/api/objective-c,swift

### objective-c ###
# xcode
#
# gitignore contributors: remember to update     global/xcode.gitignore, objective-c.gitignore & swift.gitignore

## build generated
build/
deriveddata/

## various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/

## other
*.moved-aside
*.xcuserstate

## obj-c/swift specific
*.hmap
*.ipa

# 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://github.com/fastlane/fastlane/blob/master/fastlane/docs/gitignore.md

fastlane/report.xml
fastlane/screenshots

### objective-c patch ###
*.xcscmblueprint

### swift ###
# xcode
#
# gitignore contributors: remember to update   global/xcode.gitignore, objective-c.gitignore & swift.gitignore

## build generated
build/
deriveddata/

## various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/

## other
*.moved-aside
*.xcuserstate

## obj-c/swift specific
*.hmap
*.ipa

## playgrounds
timeline.xctimeline
playground.xcworkspace

# swift package manager
#
# add this line if you want to avoid checking in source code from swift package manager dependencies.
# packages/
.build/

# 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://github.com/fastlane/fastlane/blob/master/fastlane/docs/gitignore.md

fastlane/report.xml
fastlane/preview.html
fastlane/screenshots
fastlane/test_output

这个配置自动生成了很多注释和一些不太必要的配置,所以直接使用上面提供的简便配置就好。

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!