SoFunction
Updated on 2025-03-03

iOS configuration.gitignore file details

iOS configuration.gitignore file details

Why configure .gitignore

In the process of using git, not any file needs to be committed to local or remote repository, such as some tripartite library files.
So as a git newbie, many people don’t know how to configure .gitignore files. This article just provides a convenient example. You can edit it directly into your .gitigore file using the code provided in this article.

Easy configuration

Just copy the following content to your .gitignore file.Note that this configuration is for iOS developers.

# Xcode
.DS_Store
*/build/*
*.pbxuser
!
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
*.hmap
*.xccheckout
*.xcworkspace
!

#CocoaPods
Pods
!Podfile
!

Go to select custom configuration

exist Entering the language you need to configure will help you automatically generate a configuration. For example, entering Objective-C and Swift will help you generate the following configuration.

# Created by /api/objective-c,swift

### Objective-C ###
# Xcode
#
# gitignore contributors: remember to update     Global/,  & 

## Build generated
build/
DerivedData/

## Various settings
*.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:
# /using/#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:
#   /fastlane/fastlane/blob/master/fastlane/docs/

fastlane/
fastlane/screenshots

### Objective-C Patch ###
*.xcscmblueprint

### Swift ###
# Xcode
#
# gitignore contributors: remember to update   Global/,  & 

## Build generated
build/
DerivedData/

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

## Other
*.moved-aside
*.xcuserstate

## Obj-C/Swift specific
*.hmap
*.ipa

## Playgrounds



# 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:
# /using/#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:
#   /fastlane/fastlane/blob/master/fastlane/docs/

fastlane/
fastlane/
fastlane/screenshots
fastlane/test_output

This configuration automatically generates a lot of comments and some unnecessary configurations, so just use the simple configuration provided above.

Thank you for reading, I hope it can help you. Thank you for your support for this site!