Xcode给工程添加 .gitignore文件

.gitignore 文件可以用来配置Git版本控制中一些需要忽略提交的文件

1)首先通过终端进入git根文件目录

$ cd 你的项目路径

2)新建一个 .gitignore 文件

$ touch .gitignore

3)打开 .gitignore 文件

$ open .gitignore

4)添加需要被忽略的内容配置。如果不知道默认的配置的话可以上github上自己创建一个仓库,在设置.gitignore时候可以选择对应语言的 .gitignore 文件配置 如Objective-c或Swift,就可以看到对应的文件内容配置。
这里给出一份Objective-c默认配置的文件内容,没有特要求的话可以将此配置写入 .gitignore里

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

fastlane/report.xml
fastlane/screenshots

#Code Injection
#
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/

你可能感兴趣的:(Xcode给工程添加 .gitignore文件)