笔记·约 2 分钟·更新于 2021.06.23

Xcode 给工程添加 .gitignore 文件

许久不曾使用Xcode和别人协同开发,通过git进行代码管理。 最近接手一个七年前左右的项目,每次改动一点代码,看到成堆的改动提示,瞬间想到一个东西,没有添加git忽略文件。 于是,有此记录。好像在github仓库里,我有备份过。不过还是记录一下吧。 --- .gitignore 文件可以用来配置 Git 版本控制中一些需要忽略提交的文件 1) 首先通过终端进入 git 根文件目录 2) 新建一个…

许久不曾使用Xcode和别人协同开发,通过git进行代码管理。 最近接手一个七年前左右的项目,每次改动一点代码,看到成堆的改动提示,瞬间想到一个东西,没有添加git忽略文件。 于是,有此记录。好像在github仓库里,我有备份过。不过还是记录一下吧。


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

  1. 首先通过终端进入 git 根文件目录
CODE
$ cd 你的项目路径
  1. 新建一个 .gitignore 文件
CODE
$ touch .gitignore
  1. 打开 .gitignore 文件
CODE
$ open .gitignore
  1. 添加需要被忽略的内容配置。如果不知道默认的配置的话可以上 github 上自己创建一个仓库,在设置.gitignore 时候可以选择对应语言的 .gitignore 文件配置 如 Objective-C 或 Swift,就可以看到对应的文件内容配置。 这里给出一份 Objective-C 默认配置的文件内容,没有特要求的话可以将此配置写入 .gitignore 里。
jboss-cli · 推断
# 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/