当Git与Xcode一起使用时,我应该在.gitignore中包含哪些文件?


当前回答

你应该结账给gitignore。用于Objective-C和Swift。

下面是我正在使用的.gitignore文件:

# 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

其他回答

如果有人需要一个标准的gitignore文件作为一个简单的方法。

在导航到项目后,在cmd/ terminal中运行这一行。

npx gitignore Objective-C

GitHub的人们为Xcode项目提供了详尽的。gitignore文件:

斯威夫特:https://github.com/github/gitignore/blob/master/Swift.gitignore

objective - c: https://github.com/github/gitignore/blob/master/Objective-C.gitignore

对于Xcode 4,我还添加了:

YourProjectName.xcodeproj/xcuserdata/*
YourProjectName.xcodeproj/project.xcworkspace/xcuserdata/*

对于Xcode 5,我添加:

####
# Xcode 5 - VCS metadata
#
*.xccheckout

选自Berik的答案

gitignore。io:为你的项目创建有用的gitignore文件

Example: Preview | Edit Programming Languages: Objective-C Swift Build Automation Tool: SwiftPackageManager Carthage IDEs: Xcode Operating Systems: macOS Steps to use in Terminal (Refer to the YouTube Video) Create Git global config alias (One time only) git config --global alias.ignore '!gi() { curl -L -s https://www.gitignore.io/api/$@ ;}; gi' Enter the project directory cd <the project directory> Generate .gitignore file git ignore Objective-C,Swift,SwiftPackageManager,Carthage,Xcode,macOS >.gitignore Add and commit .gitignore file git add .gitignore git commit -m "Add .gitignore file"